base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12
[NixPkgs.git] / pkgs / by-name / k9 / k9s / package.nix
blob5bd085f2bb59d559f0277b42e81bf0adc73bc4af
1 { stdenv, lib, buildGoModule, fetchFromGitHub, installShellFiles, testers, nix-update-script, k9s }:
3 buildGoModule rec {
4   pname = "k9s";
5   version = "0.32.5";
7   src = fetchFromGitHub {
8     owner = "derailed";
9     repo = "k9s";
10     rev = "v${version}";
11     hash = "sha256-H0PimkPXs2/iirOpN82az3Bge71k1RZOhMtr0UmGOy8=";
12   };
14   ldflags = [
15     "-s"
16     "-w"
17     "-X github.com/derailed/k9s/cmd.version=${version}"
18     "-X github.com/derailed/k9s/cmd.commit=${src.rev}"
19     "-X github.com/derailed/k9s/cmd.date=1970-01-01T00:00:00Z"
20   ];
22   tags = [ "netcgo" ];
24   proxyVendor = true;
26   vendorHash = "sha256-U/tIsYpoog3S8V2yQGGqaQ+Av7TfvCYt3zn74qWuQKs=";
28   # TODO investigate why some config tests are failing
29   doCheck = !(stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64);
30   # Required to workaround test check error:
31   preCheck = "export HOME=$(mktemp -d)";
32   # For arch != x86
33   # {"level":"fatal","error":"could not create any of the following paths: /homeless-shelter/.config, /etc/xdg","time":"2022-06-28T15:52:36Z","message":"Unable to create configuration directory for k9s"}
34   passthru = {
35     tests.version = testers.testVersion {
36       package = k9s;
37       command = "HOME=$(mktemp -d) k9s version -s";
38       inherit version;
39     };
40     updateScript = nix-update-script { };
41   };
43   nativeBuildInputs = [ installShellFiles ];
44   postInstall = ''
45     # k9s requires a writeable log directory
46     # Otherwise an error message is printed
47     # into the completion scripts
48     export K9S_LOGS_DIR=$(mktemp -d)
50     installShellCompletion --cmd k9s \
51       --bash <($out/bin/k9s completion bash) \
52       --fish <($out/bin/k9s completion fish) \
53       --zsh <($out/bin/k9s completion zsh)
54   '';
56   meta = with lib; {
57     description = "Kubernetes CLI To Manage Your Clusters In Style";
58     homepage = "https://github.com/derailed/k9s";
59     changelog = "https://github.com/derailed/k9s/releases/tag/v${version}";
60     license = licenses.asl20;
61     mainProgram = "k9s";
62     maintainers = with maintainers; [ Gonzih markus1189 bryanasdev000 qjoly ];
63   };