add forgejo

This commit is contained in:
Maciej Jur 2024-05-13 21:25:59 +02:00
parent 6a3e77e142
commit c2112ea153
Signed by: kamov
GPG key ID: 191CBFF5F72ECAFD
2 changed files with 61 additions and 6 deletions

49
git.nix Normal file
View file

@ -0,0 +1,49 @@
{ config, pkgs, lib, ... }:
let
domain = "git.kamoshi.org";
user = "forgejo";
state = "/var/lib/forgejo";
in
{
users = {
users.${user} = {
description = "Forgejo Service";
home = state;
group = user;
useDefaultShell = true;
isSystemUser = true;
};
groups.${user} = {};
};
services = {
forgejo = {
enable = true;
user = user;
group = user;
stateDir = state;
# https://forgejo.org/docs/latest/admin/config-cheat-sheet/
settings = {
server = {
HTTP_PORT = 3200;
HTTP_ADDR = "127.0.0.1";
DOMAIN = domain;
ROOT_URL = "https://${domain}/";
LANDING_PAGE = "explore";
};
service = {
DISABLE_REGISTRATION = lib.mkForce true;
};
};
};
nginx.virtualHosts.${domain} = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://localhost:3200/";
};
};
};
}

18
web.nix
View file

@ -23,12 +23,18 @@
recommendedGzipSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
virtualHosts = {
"kamoshi.org" = {
root = "/var/www/kamoshi.org";
forceSSL = true;
enableACME = true;
};
virtualHosts."kamoshi.org" = {
root = "/var/www/kamoshi.org";
forceSSL = true;
enableACME = true;
listen = [
{ addr = "[::]"; port = 80; ssl = false; }
{ addr = "0.0.0.0"; port = 80; ssl = false; }
{ addr = "[::]"; port = 443; ssl = true; }
{ addr = "0.0.0.0"; port = 443; ssl = true; }
];
};
};
};