ctucx.git: nixfiles

ctucx' nixfiles

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

machines/osterei/oeffisearch: move package to pkgs
3 files changed, 33 insertions(+), 30 deletions(-)
M
machines/osterei/oeffisearch.nix
|
33
+++------------------------------
M
pkgs/default.nix
|
1
+
A
pkgs/oeffisearch.nix
|
29
+++++++++++++++++++++++++++++
diff --git a/machines/osterei/oeffisearch.nix b/machines/osterei/oeffisearch.nix
@@ -1,33 +1,6 @@
 { config, pkgs, ... }:
 
-let
-  nimhafas = pkgs.fetchgit {
-    url    = "https://cgit.ctu.cx/nimhafas";
-    rev    = "1909376e6c33d9b5c1f56139fe53e6866692dde0";
-    sha256 = "1xaj3dd8i2izja3zzvy4db7hz3q1qdsp6csf3ww24f523dyxl8rn";
-  };
-
-  oeffisearch = pkgs.nimPackages.buildNimPackage {
-    name = "smartied";
-
-    nimBinOnly  = true;
-    nimRelease  = true;
-
-    buildInputs = [ nimhafas ];
-
-    src = pkgs.fetchgit {
-      url    = "https://cgit.ctu.cx/oeffisearch";
-      rev    = "cf83faaedcabc830b12f1b6081cf4ee7913c8b73";
-      sha256 = "1vhjkhm8nnrdcrpnag7h6sznw7ji99pblh3ss7ckikcr2canxiqg";
-    };
-
-    postInstall = ''
-      mkdir $out/share;
-      cp -r $src/client $out/share/oeffisearch;
-    '';
-  };
-
-in {
+{
 
   users.groups.oeffisearch = {};
   users.users.oeffisearch = {

@@ -74,7 +47,7 @@ in {
       RestrictRealtime        = true;
       LockPersonality         = true;
 
-      ExecStart               = "${oeffisearch}/bin/oeffisearch";
+      ExecStart               = "${pkgs.oeffisearch}/bin/oeffisearch";
 
       Restart                 = "on-failure";
       RestartSec              = "5";

@@ -94,7 +67,7 @@ in {
       locations  = {
         "@api".proxyPass = "http://127.0.0.1:8081";
         "/" = {
-          root     = "${oeffisearch}/share/oeffisearch";
+          root     = "${pkgs.oeffisearch}/share/oeffisearch";
           index    = "index.html";
           tryFiles = "$uri $uri/ @api";
         };
diff --git a/pkgs/default.nix b/pkgs/default.nix
@@ -35,6 +35,7 @@
       cinny                  = final.callPackage ./cinny.nix {};
       ctucx-gallery          = final.callPackage ./gallery.nix {};
       oeffi-web              = final.callPackage ./oeffi-web.nix {};
+      oeffisearch            = final.callPackage ./oeffisearch.nix {};
       kvg-station-departures = final.callPackage ./kvg-station-departures.nix {};
       smartied               = final.callPackage ./smartied.nix {};
       smartiePWA             = final.callPackage ./smartie-pwa {};
diff --git a/pkgs/oeffisearch.nix b/pkgs/oeffisearch.nix
@@ -0,0 +1,29 @@
+{ fetchgit, nimPackages, ... }:
+
+let
+  nimhafas = fetchgit {
+    url    = "https://cgit.ctu.cx/nimhafas";
+    rev    = "1909376e6c33d9b5c1f56139fe53e6866692dde0";
+    sha256 = "1xaj3dd8i2izja3zzvy4db7hz3q1qdsp6csf3ww24f523dyxl8rn";
+  };
+
+in nimPackages.buildNimPackage {
+  name = "smartied";
+
+  nimBinOnly  = true;
+  nimRelease  = true;
+
+  buildInputs = [ nimhafas ];
+
+  src = fetchgit {
+    url    = "https://git.ctu.cx/oeffisearch";
+    rev    = "cf83faaedcabc830b12f1b6081cf4ee7913c8b73";
+    sha256 = "1vhjkhm8nnrdcrpnag7h6sznw7ji99pblh3ss7ckikcr2canxiqg";
+  };
+
+  postInstall = ''
+    mkdir $out/share;
+    cp -r $src/client $out/share/oeffisearch;
+  '';
+
+}