ctucx.git: nixfiles

ctucx' nixfiles

commit 33b1ebe6c9bde5d9fbe3aaad23e5c0b360e3218e
parent f50170fe60097d54c22b49b94a80e347611571cc
Author: Leah (ctucx) <leah@ctu.cx>
Date: Tue, 13 Sep 2022 19:36:25 +0200

machines/osterei/oeffi-web: move package to pkgs
3 files changed, 34 insertions(+), 31 deletions(-)
M
machines/osterei/oeffi-web.nix
|
35
++++-------------------------------
M
pkgs/default.nix
|
1
+
A
pkgs/oeffi-web.nix
|
29
+++++++++++++++++++++++++++++
diff --git a/machines/osterei/oeffi-web.nix b/machines/osterei/oeffi-web.nix
@@ -1,33 +1,6 @@
 { config, pkgs, ... }:
 
-let
-  nimhafas = pkgs.fetchgit {
-    url    = "https://cgit.ctu.cx/nimhafas";
-    rev    = "1909376e6c33d9b5c1f56139fe53e6866692dde0";
-    sha256 = "1xaj3dd8i2izja3zzvy4db7hz3q1qdsp6csf3ww24f523dyxl8rn";
-  };
-
-  oeffi-web = pkgs.nimPackages.buildNimPackage {
-    name = "oeffi-web";
-
-    nimBinOnly  = true;
-    nimRelease  = true;
-
-    buildInputs = [ nimhafas ];
-
-    src = pkgs.fetchgit {
-      url    = "https://cgit.ctu.cx/oeffi-web";
-      rev    = "47d021f1ae815a71325d8ee73da72383973bd571";
-      sha256 = "0xi46v3gpbqc4ngg6c7zhwy0sv7qyqn5kjg6c1244pixj5rygdlw";
-    };
-
-    postInstall = ''
-      mkdir -p $out/share/oeffi-web;
-      cp -r $src/src/assets $src/src/templates $out/share/oeffi-web/;
-    '';
-  };
-
-in {
+{
 
   dns.zones."ctu.cx".subdomains.oeffi.CNAME = [ "${config.networking.fqdn}." ];
 

@@ -47,7 +20,7 @@ in {
       User                    = "oeffisearch";
       Group                   = "oeffisearch";
 
-      WorkingDirectory        = "${oeffi-web}/share/oeffi-web";
+      WorkingDirectory        = "${pkgs.oeffi-web}/share/oeffi-web";
       ReadWritePaths          = [ "/var/lib/oeffisearch" ];
 
       PrivateTmp              = true;

@@ -68,7 +41,7 @@ in {
       RestrictRealtime        = true;
       LockPersonality         = true;
 
-      ExecStart               = "${oeffi-web}/bin/oeffi";
+      ExecStart               = "${pkgs.oeffi-web}/bin/oeffi";
 
       Restart                 = "on-failure";
       RestartSec              = "5";

@@ -87,7 +60,7 @@ in {
       forceSSL   = true;
       locations = {
         "/".proxyPass    = "http://127.0.0.1:8082";
-        "/assets/".alias = "${oeffi-web}/share/oeffi-web/assets/";
+        "/assets/".alias = "${pkgs.oeffi-web}/share/oeffi-web/assets/";
       };
     };
   };
diff --git a/pkgs/default.nix b/pkgs/default.nix
@@ -34,6 +34,7 @@
       AirSane                = final.callPackage ./AirSane {};
       cinny                  = final.callPackage ./cinny.nix {};
       ctucx-gallery          = final.callPackage ./gallery.nix {};
+      oeffi-web              = final.callPackage ./oeffi-web.nix {};
       kvg-station-departures = final.callPackage ./kvg-station-departures.nix {};
       smartied               = final.callPackage ./smartied.nix {};
       smartiePWA             = final.callPackage ./smartie-pwa {};
diff --git a/pkgs/oeffi-web.nix b/pkgs/oeffi-web.nix
@@ -0,0 +1,29 @@
+{ fetchgit, nimPackages, ... }:
+
+let
+  nimhafas = fetchgit {
+    url    = "https://cgit.ctu.cx/nimhafas";
+    rev    = "1909376e6c33d9b5c1f56139fe53e6866692dde0";
+    sha256 = "1xaj3dd8i2izja3zzvy4db7hz3q1qdsp6csf3ww24f523dyxl8rn";
+  };
+
+in nimPackages.buildNimPackage {
+  name = "oeffi-web";
+
+  nimBinOnly  = true;
+  nimRelease  = true;
+
+  buildInputs = [ nimhafas ];
+
+  src = fetchgit {
+    url    = "https://git.ctu.cx/oeffi-web";
+    rev    = "47d021f1ae815a71325d8ee73da72383973bd571";
+    sha256 = "0xi46v3gpbqc4ngg6c7zhwy0sv7qyqn5kjg6c1244pixj5rygdlw";
+  };
+
+  postInstall = ''
+    mkdir -p $out/share/oeffi-web;
+    cp -r $src/src/assets $src/src/templates $out/share/oeffi-web/;
+  '';
+
+}