mirror of
https://git.lgmrszd.xyz/Lgmrszd/nix-cfg.git
synced 2025-12-14 15:48:21 +01:00
vps1: add forgejo
This commit is contained in:
parent
1cc4297491
commit
bcd4bd5a14
3 changed files with 102 additions and 0 deletions
58
hosts/vps1/services/git.nix
Normal file
58
hosts/vps1/services/git.nix
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
# Big thanks to Pyrox for their config! https://git.pyrox.dev/pyrox/nix/src/branch/main/hosts/marvin/services/git.nix
|
||||
{ lib, pkgs, config, ... }:
|
||||
let
|
||||
rootDomain = "lgmrszd.xyz";
|
||||
domain = "git.${rootDomain}";
|
||||
|
||||
cfg = config.services.forgejo;
|
||||
srv = cfg.settings.server;
|
||||
|
||||
stateDir = "/var/lib/forgejo";
|
||||
customDir = "${stateDir}/custom";
|
||||
confDir = "${customDir}/conf";
|
||||
in
|
||||
{
|
||||
services.nginx.virtualHosts.${domain} = {
|
||||
forceSSL = true;
|
||||
useACMEHost = "${rootDomain}";
|
||||
extraConfig = ''
|
||||
client_max_body_size 512M;
|
||||
'';
|
||||
locations."/" = {
|
||||
proxyPass = "http://127.0.0.1:${toString srv.HTTP_PORT}";
|
||||
recommendedProxySettings = true;
|
||||
};
|
||||
};
|
||||
|
||||
services.forgejo = {
|
||||
enable = true;
|
||||
inherit stateDir;
|
||||
inherit customDir;
|
||||
database = {
|
||||
type = "postgres";
|
||||
createDatabase = true;
|
||||
passwordFile = config.sops.secrets."forgejo/db_password".path;
|
||||
};
|
||||
settings = {
|
||||
server = {
|
||||
DOMAIN = domain;
|
||||
ROOT_URL = "https://${srv.DOMAIN}/";
|
||||
HTTP_PORT = 3000;
|
||||
};
|
||||
service.DISABLE_REGISTRATION = true;
|
||||
actions = {
|
||||
ENABLED = false;
|
||||
};
|
||||
mailer = {
|
||||
ENABLED = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
sops.secrets."forgejo/db_password" = {
|
||||
sopsFile = ../secrets/forgejo.yaml;
|
||||
format = "yaml";
|
||||
owner = "forgejo";
|
||||
group = "forgejo";
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue