ctucx.git: oeffi-web

A fork of oeffisearch that works without javascript [hosted @ oeffi.ctu.cx]

commit 6aaa6ddcba84f8ee95b3c5c0dc2f5e7956dec9a9
parent 47d021f1ae815a71325d8ee73da72383973bd571
Author: Leah (ctucx) <git@ctu.cx>
Date: Sat, 10 Dec 2022 15:22:54 +0100

add flake.nix
3 files changed, 103 insertions(+), 2 deletions(-)
M
.gitignore
|
4
++--
A
flake.lock
|
43
+++++++++++++++++++++++++++++++++++++++++++
A
flake.nix
|
58
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
diff --git a/.gitignore b/.gitignore
@@ -4,4 +4,5 @@ cache
 data
 .DS_Store
 
-oeffi-
\ No newline at end of file
+oeffi
+result
diff --git a/flake.lock b/flake.lock
@@ -0,0 +1,43 @@
+{
+  "nodes": {
+    "flake-utils": {
+      "locked": {
+        "lastModified": 1667395993,
+        "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "type": "github"
+      }
+    },
+    "nixpkgs": {
+      "locked": {
+        "lastModified": 1670543317,
+        "narHash": "sha256-4mMR56rtxKr+Gwz399jFr4i76SQZxsLWxxyfQlPXRm0=",
+        "owner": "NixOS",
+        "repo": "nixpkgs",
+        "rev": "7a6a010c3a1d00f8470a5ca888f2f927f1860a19",
+        "type": "github"
+      },
+      "original": {
+        "owner": "NixOS",
+        "ref": "nixos-22.11",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
+    "root": {
+      "inputs": {
+        "flake-utils": "flake-utils",
+        "nixpkgs": "nixpkgs"
+      }
+    }
+  },
+  "root": "root",
+  "version": 7
+}
diff --git a/flake.nix b/flake.nix
@@ -0,0 +1,58 @@
+{
+  description = "A fork of oeffisearch that works without javascript";
+
+  inputs = {
+    flake-utils.url = "github:numtide/flake-utils";
+    nixpkgs.url     = "github:NixOS/nixpkgs/nixos-22.11";
+  };
+
+  outputs = { self, nixpkgs, flake-utils }: {
+
+    overlay = final: prev: {
+
+      oeffi-web = (
+        let
+          nimhafas = final.fetchgit {
+            url    = "https://cgit.ctu.cx/nimhafas";
+            rev    = "1909376e6c33d9b5c1f56139fe53e6866692dde0";
+            sha256 = "1xaj3dd8i2izja3zzvy4db7hz3q1qdsp6csf3ww24f523dyxl8rn";
+          };
+
+        in final.nimPackages.buildNimPackage {
+          name        = "oeffi-web";
+          src         = self;
+
+          buildInputs = [ nimhafas ];
+
+          nimBinOnly  = true;
+          nimRelease  = true;
+
+          postInstall = ''
+            mkdir -p $out/share/oeffi-web;
+            cp -r $src/src/assets $src/src/templates $out/share/oeffi-web/;
+          '';
+        }
+      );
+
+    };
+
+  } // (flake-utils.lib.eachDefaultSystem (system:
+    let
+      pkgs = import nixpkgs {
+        inherit system;
+        overlays = [ self.overlay ];
+      };
+
+    in rec {
+
+      packages.default   = pkgs.oeffi-web;
+      packages.oeffi-web = pkgs.oeffi-web;
+
+      apps.default = {
+        type = "app";
+        program = "${pkgs.oeffi-web}/bin/oeffi";
+      };
+
+    }
+  ));
+}