ctucx.git: nixfiles

ctucx' nixfiles

commit a717ba69649c601c19ea1bf18f5da0490ed32dd3
parent 40a5b953dba094e30aa2d446fa6509021d8abe48
Author: Leah (ctucx) <leah@ctu.cx>
Date: Fri, 27 May 2022 13:23:51 +0200

machines/osterei/websites/bikemap: use services.gitolite.hooks.postReceive
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/machines/osterei/websites/ctu.cx-bikemap/default.nix b/machines/osterei/websites/ctu.cx-bikemap/default.nix
@@ -34,7 +34,7 @@ let
     mkdir -p tiles/$2/$3
     echo "rendering $1 $2 $3 $4 $5 $6"
 
-    if [$2 -gt 13 ]
+    if [ $2 -gt 13 ]
     then 
       ${datamaps}/bin/render -g -t0 -L4 -c 'ff8800' -S 'ff8800' $1 $2 $3 $4 | ${pkgs.pngquant}/bin/pngquant 256 > tiles/$2/$3/$4.png
     else 

@@ -47,14 +47,6 @@ let
     systemctl status deploy-bikemap;
   '';
 
-  deployHook = pkgs.writeShellScriptBin "post-receive" ''
-    [ -t 0 ] || cat >/dev/null
-    [ -z "$GL_REPO" ] && die GL_REPO not set
-
-    #deploy bikemap
-    [ "$GL_REPO" == "bikemap" ] && sudo ${deployScript}
-  '';
-
 in {
 
   users = {

@@ -122,7 +114,11 @@ in {
   };
 
   services = {
-    gitolite.commonHooks = [ "${deployHook}/bin/post-receive" ];
+    gitolite.hooks.postReceive = ''
+      #deploy bikemap
+      [ "$GL_REPO" == "bikemap" ] && sudo ${deployScript}
+    '';
+
     nginx = {
       enable = true;
       virtualHosts."ctu.cx" = {