about summary refs log tree commit diff
path: root/pkgs/shells
diff options
context:
space:
mode:
authorScott Zhu Reeves <327943+star-szr@users.noreply.github.com>2023-04-01 09:46:25 -0400
committerScott Zhu Reeves <327943+star-szr@users.noreply.github.com>2023-04-01 09:51:30 -0400
commit0b39ed44dd08d37a9364cd39bc20f097c1fb07b7 (patch)
tree95929ce916b05753e66f820de59245107e32af49 /pkgs/shells
parent3487ae7d0f39f09ab755adb07213c3cf03a67e47 (diff)
carapace: add ldflags for version
With this change, `carapace --version` returns the correct version
rather than `develop`. I tested a binary downloaded from their releases
page and this is the correct format, there should not be a v prefix or
anything else.
Diffstat (limited to 'pkgs/shells')
-rw-r--r--pkgs/shells/carapace/default.nix12
1 files changed, 10 insertions, 2 deletions
diff --git a/pkgs/shells/carapace/default.nix b/pkgs/shells/carapace/default.nix
index b740851590986..dae5b9bc442de 100644
--- a/pkgs/shells/carapace/default.nix
+++ b/pkgs/shells/carapace/default.nix
@@ -1,4 +1,4 @@
-{ lib, buildGoModule, fetchFromGitHub }:
+{ lib, buildGoModule, fetchFromGitHub, testers, carapace }:
 
 buildGoModule rec {
   pname = "carapace";
@@ -13,6 +13,12 @@ buildGoModule rec {
 
   vendorHash = "sha256-s8U0ERAb/qLwen8ABfeZ21HLTgHWvHaYHazztSeP87c=";
 
+  ldflags = [
+    "-s"
+    "-w"
+    "-X main.version=${version}"
+  ];
+
   subPackages = [ "./cmd/carapace" ];
 
   tags = [ "release" ];
@@ -21,10 +27,12 @@ buildGoModule rec {
     go generate ./...
   '';
 
+  passthru.tests.version = testers.testVersion { package = carapace; };
+
   meta = with lib; {
     description = "Multi-shell multi-command argument completer";
     homepage = "https://rsteube.github.io/carapace-bin/";
-    maintainers = with maintainers; [ mredaelli ];
+    maintainers = with maintainers; [ star-szr ];
     license = licenses.mit;
     platforms = platforms.unix;
   };