about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2024-05-14 21:15:19 +0200
committerAlan Pearce2024-05-14 21:15:19 +0200
commitf08094f23aa4dc7d63a7c98b4429d88005fe3a2d (patch)
treee21e870c8b2c4e713a4870c9f0620dc25a7b1e53
parent606030924bbfeec7a1ff42351c844bb20eb6dc08 (diff)
downloadsearchix-f08094f23aa4dc7d63a7c98b4429d88005fe3a2d.tar.lz
searchix-f08094f23aa4dc7d63a7c98b4429d88005fe3a2d.tar.zst
searchix-f08094f23aa4dc7d63a7c98b4429d88005fe3a2d.zip
build: use a nixpkgs-approved version scheme
-rw-r--r--flake.nix1
-rw-r--r--nix/package.nix11
2 files changed, 11 insertions, 1 deletions
diff --git a/flake.nix b/flake.nix
index 7229523..48697c5 100644
--- a/flake.nix
+++ b/flake.nix
@@ -45,6 +45,7 @@
           packages.default = callPackage ./nix/package.nix {
             inherit (gomod2nix.legacyPackages.${system}) buildGoApplication;
             css = simple-css;
+            inherit self;
           };
           devShells.default = callPackage ./nix/dev-shell.nix {
             pre-commit-check = {
diff --git a/nix/package.nix b/nix/package.nix
index 8e1cf54..5e47c9b 100644
--- a/nix/package.nix
+++ b/nix/package.nix
@@ -11,10 +11,19 @@
   )
 , buildGoApplication ? pkgs.buildGoApplication
 , css
+, self
 }:
+let
+  inherit (builtins) concatStringsSep match;
+
+  version = concatStringsSep "-" (match
+    "([[:digit:]]{4})([[:digit:]]{2})([[:digit:]]{2}).*"
+    self.lastModifiedDate
+  );
+in
 buildGoApplication {
   pname = "searchix";
-  version = "0.1";
+  inherit version;
   src = with pkgs.lib.fileset; toSource {
     root = ../.;
     fileset = difference