started forgejo config

This commit is contained in:
John Lancaster
2026-03-31 20:17:52 -05:00
parent b6a85631f3
commit 395e13acd2
4 changed files with 71 additions and 9 deletions
+62
View File
@@ -0,0 +1,62 @@
{ self, inputs, ... }: {
flake.modules.nixos.forgejo = {config, pkgs, lib, ... }:
let
cfg = config.forgejo;
in
{
options.forgejo = {
enable = lib.mkEnableOption "Enable Forgejo backed with PostgreSQL";
port = lib.mkOption {
type = lib.types.port;
default = 3000;
description = "TCP port for the Forgejo web interface.";
};
openFirewall = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Open the Forgejo web interface port in the firewall.";
};
https = lib.mkEnableOption "Open the Forgejo web interface port in the firewall.";
};
config = lib.mkIf cfg.enable {
networking.firewall.allowedTCPPorts = lib.optionals cfg.openFirewall [ cfg.port ];
services.forgejo = {
enable = true;
lfs.enable = true;
settings.server = lib.mkMerge [
{
HTTP_PORT = cfg.port;
DISABLE_SSH = true;
}
(lib.mkIf cfg.https {
ROOT_URL = "https://forgejo.john-stream.com";
PROTOCOL = "https";
COOKIE_SECURE = true;
})
];
database = {
type = "postgres";
port = config.services.postgresql.settings.port;
# createDatabase = false;
};
# dump = {
# enable = true;
# interval = "12h";
# };
};
services.postgresql = {
enable = true;
settings = {
};
};
};
};
}
+1 -1
View File
@@ -3,7 +3,7 @@ let
username = "john";
hostname = "john-pc-ubuntu";
testHost = "soteria";
testHost = "soteria"; # which host to test build
testTarget = "fded:fb16:653e:25da:be24:11ff:fea0:753f"; # test-nix
# testTarget = "fded:fb16:653e:25da:be24:11ff:fe89:1cc3"; # soteria
+3
View File
@@ -14,6 +14,7 @@ in
nixos.docker
nixos.mtls
nixos.janus-ca
nixos.forgejo
# nixos.restic-server
# nixos.restic-envoy
({ pkgs, ... }: {
@@ -64,6 +65,8 @@ in
environment.systemPackages = [
inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.janus-ca
];
forgejo.enable = true;
})
];
};
+5 -8
View File
@@ -18,15 +18,12 @@
isNormalUser = true;
home = "/home/${username}";
shell = lib.mkIf config.programs.zsh.enable pkgs.zsh;
extraGroups = [
"input"
"networkmanager"
] ++ lib.optionals isAdmin [
"docker"
"wheel"
];
extraGroups = [ "input" "networkmanager" ]
++ lib.optional isAdmin "wheel"
++ lib.optional config.virtualisation.docker.enable "docker"
++ lib.optional (isAdmin && config.services.forgejo.enable) config.services.forgejo.group
++ lib.optional (isAdmin && config.services.postgresql.enable) config.services.postgresql.group;
};
security.sudo-rs.enable = lib.mkIf isAdmin true;