about summary refs log tree commit diff stats
path: root/nix/package.nix
diff options
context:
space:
mode:
authorAlan Pearce2024-05-12 22:34:23 +0200
committerAlan Pearce2024-05-12 23:12:39 +0200
commit895a3b061bb4717955ffbceab3bf3c6ecebacd70 (patch)
treefed970785b9b0460693d07dcffae08283be90ce4 /nix/package.nix
parent7077a3748fa545e8dee83d4f3464c55b4b459183 (diff)
downloadsearchix-895a3b061bb4717955ffbceab3bf3c6ecebacd70.tar.lz
searchix-895a3b061bb4717955ffbceab3bf3c6ecebacd70.tar.zst
searchix-895a3b061bb4717955ffbceab3bf3c6ecebacd70.zip
build: switch to flakes
Diffstat (limited to 'nix/package.nix')
-rw-r--r--nix/package.nix37
1 files changed, 37 insertions, 0 deletions
diff --git a/nix/package.nix b/nix/package.nix
new file mode 100644
index 0000000..6c942b0
--- /dev/null
+++ b/nix/package.nix
@@ -0,0 +1,37 @@
+{ pkgs ? (
+    let
+      inherit (builtins) fetchTree fromJSON readFile;
+      inherit ((fromJSON (readFile ./flake.lock)).nodes) nixpkgs gomod2nix;
+    in
+    import (fetchTree nixpkgs.locked) {
+      overlays = [
+        (import "${fetchTree gomod2nix.locked}/overlay.nix")
+      ];
+    }
+  )
+, buildGoApplication ? pkgs.buildGoApplication
+, css
+}:
+buildGoApplication {
+  pname = "searchix";
+  version = "0.1";
+  src = with pkgs.lib.fileset; toSource {
+    root = ../.;
+    fileset = difference
+      (unions [
+        ../go.mod
+        ../go.sum
+        ../serve
+        ../import
+        ../internal
+        ../frontend
+      ])
+      (maybeMissing ../frontend/static/base.css);
+  };
+
+  patchPhase = ''
+    cp ${css} frontend/static/base.css
+  '';
+  tags = [ "embed" ];
+  modules = ../gomod2nix.toml;
+}