summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--system/settings/services/git-server.nix34
1 files changed, 17 insertions, 17 deletions
diff --git a/system/settings/services/git-server.nix b/system/settings/services/git-server.nix
index 946bf4ba..54e8560c 100644
--- a/system/settings/services/git-server.nix
+++ b/system/settings/services/git-server.nix
@@ -4,8 +4,7 @@
 , ...
 }:
 let
-  inherit (builtins) mapAttrs attrValues;
-  inherit (lib) pipe flatten mergeAttrsList mapAttrsToList;
+  inherit (lib) pipe flatten concatMapAttrs mergeAttrsList mapAttrsToList;
   inherit (import ../../../lib/caddy.nix { inherit lib; }) security-headers;
   repos = "${config.services.gitolite.dataDir}/repositories";
 
@@ -35,7 +34,7 @@ let
   createMirrorService =
     name: { hostname, username }:
     {
-      services."mirror-to-${name}@" = {
+      "mirror-to-${name}@" = {
         path = with pkgs; [ gitMinimal openssh ];
         serviceConfig = {
           Type = "oneshot";
@@ -48,7 +47,11 @@ let
           ConditionPathExists = "${repos}/%i.git/git-daemon-export-ok";
         };
       };
-      paths."mirror-to-${name}@" = {
+    };
+
+  createMirrorPath = name: { hostname, username }:
+    {
+      "mirror-to-${name}@" = {
         pathConfig = {
           PathChanged = "${repos}/%i.git/refs/heads";
           StartLimitIntervalSec = "1h";
@@ -57,6 +60,7 @@ let
       };
     };
 
+
   mkMirrorWants = repo: map (target: "mirror-to-${target}@${repo}.path");
 in
 {
@@ -262,18 +266,14 @@ in
     ];
   };
 
-  systemd = (pipe
-    mirrors [
-    (mapAttrsToList createMirrorService)
-    mergeAttrsList
-  ]) // {
-    targets.git-mirroring = {
-      wantedBy = [ "multi-user.target" ];
-      wants = pipe
-        repoMirrors [
-        (mapAttrsToList mkMirrorWants)
-        flatten
-      ];
-    };
+  systemd.services = concatMapAttrs createMirrorService mirrors;
+  systemd.paths = concatMapAttrs createMirrorPath mirrors;
+  systemd.targets.git-mirroring = {
+    wantedBy = [ "multi-user.target" ];
+    wants = pipe
+      repoMirrors [
+      (mapAttrsToList mkMirrorWants)
+      flatten
+    ];
   };
 }