k9s: use finalAttrs, renew

- finalAttrs for correct overriding
- use tag instead of rev to prevent ambiguity in revs
- remove ldflag -w, it's implied by -s

Signed-off-by: Paul Meyer <katexochen0@gmail.com>
This commit is contained in:
Paul Meyer 2025-07-12 16:49:38 +02:00
parent 9c492c3233
commit e03fbf701d

View File

@ -10,22 +10,21 @@
writableTmpDirAsHomeHook, writableTmpDirAsHomeHook,
}: }:
buildGoModule rec { buildGoModule (finalAttrs: {
pname = "k9s"; pname = "k9s";
version = "0.50.7"; version = "0.50.7";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "derailed"; owner = "derailed";
repo = "k9s"; repo = "k9s";
rev = "v${version}"; tag = "v${finalAttrs.version}";
hash = "sha256-K0JETHs2vOOfDUPw22x+2O5WN0rtkXsRxMnUHrCpkDg="; hash = "sha256-K0JETHs2vOOfDUPw22x+2O5WN0rtkXsRxMnUHrCpkDg=";
}; };
ldflags = [ ldflags = [
"-s" "-s"
"-w" "-X github.com/derailed/k9s/cmd.version=${finalAttrs.version}"
"-X github.com/derailed/k9s/cmd.version=${version}" "-X github.com/derailed/k9s/cmd.commit=${finalAttrs.src.rev}"
"-X github.com/derailed/k9s/cmd.commit=${src.rev}"
"-X github.com/derailed/k9s/cmd.date=1970-01-01T00:00:00Z" "-X github.com/derailed/k9s/cmd.date=1970-01-01T00:00:00Z"
]; ];
@ -44,7 +43,7 @@ buildGoModule rec {
tests.version = testers.testVersion { tests.version = testers.testVersion {
package = k9s; package = k9s;
command = "HOME=$(mktemp -d) k9s version -s"; command = "HOME=$(mktemp -d) k9s version -s";
inherit version; inherit (finalAttrs) version;
}; };
updateScript = nix-update-script { }; updateScript = nix-update-script { };
}; };
@ -67,7 +66,7 @@ buildGoModule rec {
meta = { meta = {
description = "Kubernetes CLI To Manage Your Clusters In Style"; description = "Kubernetes CLI To Manage Your Clusters In Style";
homepage = "https://github.com/derailed/k9s"; homepage = "https://github.com/derailed/k9s";
changelog = "https://github.com/derailed/k9s/releases/tag/v${version}"; changelog = "https://github.com/derailed/k9s/releases/tag/v${finalAttrs.version}";
license = lib.licenses.asl20; license = lib.licenses.asl20;
mainProgram = "k9s"; mainProgram = "k9s";
maintainers = with lib.maintainers; [ maintainers = with lib.maintainers; [
@ -79,4 +78,4 @@ buildGoModule rec {
ryan4yin ryan4yin
]; ];
}; };
} })