ctucx.git: nixfiles

ctucx' nixfiles

commit d37edb2820febe4b01e9bdb81751b7f49c3ef267
parent f83d078fe3f9f89d05eb047ca403d25892ffa850
Author: Leah (ctucx) <leah@ctu.cx>
Date: Mon, 30 May 2022 20:41:24 +0200

machines/osterei/websites/bikemap: fetch tracks from extra repo
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/machines/osterei/git/stagit.nix b/machines/osterei/git/stagit.nix
@@ -24,12 +24,11 @@ let
       # generate index arguments
       args="-n 'ctucx.git' -e 'git@ctu.cx'"
 
-      for category in "etc" "nimlang" "nimlang libraries" "php" "​archive"; do
+      for category in "etc" "nimlang" "nimlang libraries" "php" "archive"; do
         args="$args -c '$category'"
         for repo in "$HOME/repositories/"*.git/; do
           repo="''${repo%/}"
           is_public_and_listed "$repo" || continue
-          [[ "$repo" == "/var/lib/gitolite/repositories/bikemap.git" ]] && continue
 
           [ "$(${pkgs.gawk}/bin/awk -F '=' '/category/ {print $2}' $repo/config | ${pkgs.gnused}/bin/sed -e 's/^[[:space:]]*//')" = "$category" ] && args="$args $repo"
         done
diff --git a/machines/osterei/websites/ctu.cx-bikemap/default.nix b/machines/osterei/websites/ctu.cx-bikemap/default.nix
@@ -3,12 +3,14 @@
 let
   parse-gpx = pkgs.stdenv.mkDerivation rec {
     name = "parse-gpx";
-    src  = ./parse-gpx;
+    src  = ./parse-gpx.pl;
+
+    dontUnpack = true;
 
     nativeBuildInputs = [ pkgs.makeWrapper ];
     buildInputs       = [ pkgs.perl ];
 
-    installPhase = ''mkdir -p $out/bin; cp parse-gpx $out/bin; chmod +x $out/bin/parse-gpx;'';
+    installPhase = ''mkdir -p $out/bin; cp $src $out/bin/parse-gpx; chmod +x $out/bin/parse-gpx;'';
     postFixup    = ''wrapProgram $out/bin/parse-gpx --prefix PERL5LIB : "${with pkgs.perlPackages; makePerlPath [ XMLParser ]}"'';
   };
 

@@ -70,14 +72,15 @@ in {
         tmpdir=$(mktemp -d);
         cd $tmpdir
 
-        ${pkgs.git}/bin/git clone /var/lib/gitolite/repositories/bikemap.git $tmpdir
+        ${pkgs.git}/bin/git clone /var/lib/gitolite/repositories/bikemap.git $tmpdir;
+        ${pkgs.git}/bin/git clone /var/lib/gitolite/repositories/biketracks.git $tmpdir/tracks;
 
         find $tmpdir/tracks -name '*.gpx' -print0 | xargs -0 ${parse-gpx}/bin/parse-gpx | ${datamaps}/bin/encode -z16 -m8 -o $tmpdir/gpx.dm
         ${datamaps}/bin/enumerate -s -Z6 -z16 ./gpx.dm | xargs -L1 -P3 ${makeTile}
 
         rm -rf ~/*;
 
-        cp -r  $tmpdir/dist/* ~/.;
+        cp -r  $tmpdir/{index.html,bundle.js} ~/.;
         cp -r  $tmpdir/tiles ~/tiles;
         echo "{\"lastUpdated\":\"$(date +"%Y-%m-%d %H:%M")\"}" > ~/lastUpdated.json;
 

@@ -117,6 +120,7 @@ in {
     gitolite.hooks.postReceive = ''
       #deploy bikemap
       [ "$GL_REPO" == "bikemap" ] && sudo ${deployScript}
+      [ "$GL_REPO" == "biketracks" ] && sudo ${deployScript}
     '';
 
     nginx = {
diff --git a/machines/osterei/websites/ctu.cx-bikemap/parse-gpx/parse-gpx b/machines/osterei/websites/ctu.cx-bikemap/parse-gpx.pl