about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--hosts/common/server/gitea.nix42
-rw-r--r--hosts/profiles/nas.nix4
-rw-r--r--modules/services/default.nix2
-rw-r--r--modules/services/gitea/default.nix52
4 files changed, 58 insertions, 42 deletions
diff --git a/hosts/common/server/gitea.nix b/hosts/common/server/gitea.nix
deleted file mode 100644
index d606c75..0000000
--- a/hosts/common/server/gitea.nix
+++ /dev/null
@@ -1,42 +0,0 @@
-{ config, pkgs, lib, ... }:
-
-let cfg = config.services.gitea;
-in {
-  users.users.git = {
-    description = "Gitea Service";
-    home = cfg.stateDir;
-    useDefaultShell = true;
-    group = "git";
-    isSystemUser = true;
-  };
-  users.groups.git = { };
-
-  services.gitea = {
-    enable = true;
-    user = "git";
-    domain = "git.fcuny.net";
-    appName = "${cfg.domain}";
-    rootUrl = "https://${cfg.domain}/";
-    httpAddress = "127.0.0.1";
-    httpPort = 8002;
-    log.level = "Error";
-    settings = { other.SHOW_FOOTER_VERSION = false; };
-    dump.enable = false;
-    database = {
-      type = "sqlite3";
-      user = cfg.user;
-    };
-  };
-
-  services.restic.backups = {
-    gitea = {
-      paths = [ cfg.stateDir ];
-      repository = "/data/slow/backups/systems";
-      passwordFile = config.age.secrets.restic-repo-systems.path;
-      timerConfig = { OnCalendar = "00:15"; };
-      initialize = true;
-      extraBackupArgs = [ "--tag gitea" ];
-      pruneOpts = [ "--keep-daily 7" "--keep-weekly 4 --keep-monthly 6" ];
-    };
-  };
-}
diff --git a/hosts/profiles/nas.nix b/hosts/profiles/nas.nix
index bcc221c..112eda7 100644
--- a/hosts/profiles/nas.nix
+++ b/hosts/profiles/nas.nix
@@ -27,6 +27,10 @@
     unifi = { enable = true; };
     prometheus = { enable = true; };
     grafana = { enable = true; };
+    gitea = {
+      enable = true;
+      stateDir = "/var/lib/gitea";
+    };
   };
 
   services.restic.backups = {
diff --git a/modules/services/default.nix b/modules/services/default.nix
index 97a326a..94250d2 100644
--- a/modules/services/default.nix
+++ b/modules/services/default.nix
@@ -3,6 +3,8 @@
 {
   imports = [
     ./fwupd
+    ./gitea
+    ./grafana
     ./navidrome
     ./prometheus
     ./samba
diff --git a/modules/services/gitea/default.nix b/modules/services/gitea/default.nix
new file mode 100644
index 0000000..3551069
--- /dev/null
+++ b/modules/services/gitea/default.nix
@@ -0,0 +1,52 @@
+{ config, pkgs, lib, ... }:
+let cfg = config.my.services.gitea;
+in {
+  options.my.services.gitea = with lib; {
+    enable = mkEnableOption "gitea git server";
+    stateDir = mkOption {
+      type = types.str;
+      example = "/var/lib/gitea";
+      description = "gitea base directory";
+    };
+  };
+
+  config = lib.mkIf cfg.enable {
+    users.users.git = {
+      description = "Gitea Service";
+      home = cfg.stateDir;
+      useDefaultShell = true;
+      group = "git";
+      isSystemUser = true;
+    };
+    users.groups.git = { };
+
+    services.gitea = {
+      enable = true;
+      user = "git";
+      domain = "git.fcuny.net";
+      appName = "${cfg.domain}";
+      rootUrl = "https://${cfg.domain}/";
+      httpAddress = "127.0.0.1";
+      httpPort = 8002;
+      log.level = "Error";
+      settings = { other.SHOW_FOOTER_VERSION = false; };
+      dump.enable = false;
+      database = {
+        type = "sqlite3";
+        user = cfg.user;
+      };
+    };
+
+    services.restic.backups = {
+      gitea = {
+        paths = [ cfg.stateDir ];
+        repository = "/data/slow/backups/systems";
+        passwordFile = config.age.secrets.restic-repo-systems.path;
+        timerConfig = { OnCalendar = "00:15"; };
+        initialize = true;
+        extraBackupArgs = [ "--tag gitea" ];
+        pruneOpts = [ "--keep-daily 7" "--keep-weekly 4 --keep-monthly 6" ];
+      };
+    };
+  };
+}