From 9b00e006660893fac1f1d39ac1f0f675d7c967cd Mon Sep 17 00:00:00 2001 From: Brian McGee Date: Fri, 10 May 2024 10:56:20 +0100 Subject: [PATCH] feat: set nix package version to shortRev Signed-off-by: Brian McGee --- nix/packages.nix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/nix/packages.nix b/nix/packages.nix index 1c33d15..ee754f9 100644 --- a/nix/packages.nix +++ b/nix/packages.nix @@ -1,4 +1,8 @@ -{inputs, ...}: { +{ + self, + inputs, + ... +}: { imports = [ inputs.flake-parts.flakeModules.easyOverlay ]; @@ -13,7 +17,9 @@ packages = rec { treefmt = inputs'.gomod2nix.legacyPackages.buildGoApplication rec { pname = "treefmt"; - version = "2.0.0+dev"; + # there's no good way of tying in the version to a git tag or branch + # so for simplicity's sake we set the version as the commit revision hash + version = self.shortRev or self.dirtyShortRev; # ensure we are using the same version of go to build with inherit (pkgs) go; @@ -36,6 +42,8 @@ modules = ../gomod2nix.toml; + CGO_ENABLED = 1; + ldflags = [ "-s" "-w"