added server configs

This commit is contained in:
Bryan Ramos 2025-01-11 05:52:22 -05:00
parent 34ce975a09
commit 10e8a34586
Signed by: bryan
GPG key ID: 6ABDCD144D6643C8
4 changed files with 152 additions and 2 deletions

View file

@ -0,0 +1,58 @@
{ pkgs, lib, config, ... }:
with lib;
let
cfg = config.modules.system.forgejo;
nginx = config.modules.system.nginx;
in
{ options.modules.system.forgejo = { enable = mkEnableOption "Forgejo Server"; };
config = mkIf cfg.enable {
users = {
users = {
"git" = {
description = "Git server system user";
isSystemUser = true;
group = "git";
extraGroups = mkIf nginx.enable [
"web"
];
};
"nginx" = {
extraGroups = mkIf nginx.enable [
"git"
];
};
};
groups = {
"git" = {
members = [
"git"
];
};
};
};
services.forgejo = rec {
enable = true;
user = "git";
group = "git";
stateDir = "/var/lib/forgejo";
settings = {
server = {
PROTOCOL = "http+unix";
DOMAIN = "127.0.0.1";
HTTP_ADDR = "/run/forgejo/forgejo.sock";
};
};
database = {
inherit user;
type = "sqlite3";
path = "${stateDir}/data/forgejo.db";
createDatabase = true;
};
};
};
}