From 0b39ed44dd08d37a9364cd39bc20f097c1fb07b7 Mon Sep 17 00:00:00 2001 From: Scott Zhu Reeves <327943+star-szr@users.noreply.github.com> Date: Sat, 1 Apr 2023 09:46:25 -0400 Subject: [PATCH] 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. --- maintainers/maintainer-list.nix | 6 ++++++ pkgs/shells/carapace/default.nix | 12 ++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index b7f414317c3d..70700e0cbe0a 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -14349,6 +14349,12 @@ githubId = 6362238; name = "Christoph Honal"; }; + star-szr = { + email = "nixpkgs@scottr.mailworks.org"; + github = "star-szr"; + githubId = 327943; + name = "Scott Zhu Reeves"; + }; stasjok = { name = "Stanislav Asunkin"; email = "nixpkgs@stasjok.ru"; diff --git a/pkgs/shells/carapace/default.nix b/pkgs/shells/carapace/default.nix index b74085159098..dae5b9bc442d 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; };