ctucx.git: nixfiles

ctucx' nixfiles

commit 5f167c1a8cb9f430bb80de8335181d7db8ada43c
parent c85eddaea2debf163a94bbf6e0ed4793810b0cce
Author: Leah (ctucx) <git@ctu.cx>
Date: Tue, 16 May 2023 20:39:42 +0200

modules/linux/gitolite: add commands option
1 file changed, 12 insertions(+), 3 deletions(-)
M
modules/linux/gitolite.nix
|
15
++++++++++++---
diff --git a/modules/linux/gitolite.nix b/modules/linux/gitolite.nix
@@ -1,4 +1,3 @@
-
 { config, lib, pkgs, ... }:
 
 with lib;

@@ -16,6 +15,7 @@ let
         '' + script else script)
   )) cfg.commonHooks;
   triggers   = lib.mapAttrs (name: script: (pkgs.writeShellScript name script)) cfg.triggers;
+  commands   = lib.mapAttrs (name: script: (pkgs.writeShellScript name script)) cfg.commands;
 
 in {
 

@@ -63,6 +63,11 @@ in {
         default = {};
       };
 
+      commands =  mkOption {
+        type = types.attrsOf types.lines;
+        default = {};
+      };
+
       extraGitoliteRc = mkOption {
         type = types.lines;
         default = "";

@@ -227,10 +232,14 @@ in {
           mkdir -p .gitolite/local/hooks/common/
           ${lib.concatStringsSep "\n" (lib.mapAttrsToList (name: script: "ln -s ${script} .gitolite/local/hooks/common/${name}") hooks)}
           
-          rm -rf .gitolite/local/triggers
-          mkdir -p .gitolite/local/triggers
+          rm -rf .gitolite/local/triggers/
+          mkdir -p .gitolite/local/triggers/
           ${lib.concatStringsSep "\n" (lib.mapAttrsToList (name: script: "ln -s ${script} .gitolite/local/triggers/${name}") triggers)}
 
+          rm -rf .gitolite/local/commands/
+          mkdir -p .gitolite/local/commands/
+          ${lib.concatStringsSep "\n" (lib.mapAttrsToList (name: script: "ln -s ${script} .gitolite/local/commands/${name}") commands)}
+
           gitolite setup # Upgrade if needed
         '';
     };