about summary refs log tree commit diff stats
path: root/nix/default.nix
diff options
context:
space:
mode:
authorAlan Pearce2024-04-25 02:09:40 +0200
committerAlan Pearce2024-04-25 02:09:40 +0200
commitb27825139e77cd8c527ada7c712f186c94444c04 (patch)
tree9761092548819868f3e06bcf15ef3c373dc00046 /nix/default.nix
parentac9646a38aaa39ca9cb7e0aa2efa370e463abaa0 (diff)
downloadwebsite-b27825139e77cd8c527ada7c712f186c94444c04.tar.lz
website-b27825139e77cd8c527ada7c712f186c94444c04.tar.zst
website-b27825139e77cd8c527ada7c712f186c94444c04.zip
brand exe with both long and short commit hashes
Diffstat (limited to 'nix/default.nix')
-rw-r--r--nix/default.nix10
1 files changed, 9 insertions, 1 deletions
diff --git a/nix/default.nix b/nix/default.nix
index 10d52a0..e818c5a 100644
--- a/nix/default.nix
+++ b/nix/default.nix
@@ -1,6 +1,7 @@
 { pkgs, self }:
 let
   version = "unstable";
+  shortSHA = self.shortRev or self.dirtyShortRev;
   fullSHA = self.rev or self.dirtyRev;
   mkDocker = type: { server, website }:
     let
@@ -75,7 +76,14 @@ with pkgs; rec {
     };
     modules = ./gomod2nix.toml;
     subPackages = [ "cmd/server" ];
-    ldflags = [ "-s" "-w" "-X" "main.Commit=${fullSHA}" ];
+    ldflags = [
+      "-s"
+      "-w"
+      "-X"
+      "main.CommitSHA=${fullSHA}"
+      "-X"
+      "main.ShortSHA=${shortSHA}"
+    ];
   };
   docker-stream = mkDockerStream { inherit server website; };
   docker-stream-aarch64-linux = mkDockerStream {