1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
{
stdenv,
lib,
buildGoModule,
fetchFromGitHub,
installShellFiles,
makeWrapper,
testers,
nix-update-script,
k9s,
kubectl,
writableTmpDirAsHomeHook,
}:
buildGoModule (finalAttrs: {
pname = "k9s";
version = "0.51.0";
src = fetchFromGitHub {
owner = "derailed";
repo = "k9s";
tag = "v${finalAttrs.version}";
hash = "sha256-70Rfu1BVd/QnwWXRRpwIeZ2UJNWIGixpdiOHo4v7adA=";
};
ldflags = [
"-s"
"-X github.com/derailed/k9s/cmd.version=${finalAttrs.version}"
"-X github.com/derailed/k9s/cmd.commit=${finalAttrs.src.rev}"
"-X github.com/derailed/k9s/cmd.date=1970-01-01T00:00:00Z"
];
tags = [ "netcgo" ];
proxyVendor = true;
vendorHash = "sha256-PkYDJK2oGl+siCG9p4R8shC0e5BhGFdJsc+ksL9J5zw=";
# TODO investigate why some config tests are failing
doCheck = !(stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64);
# For arch != x86
# {"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"}
passthru = {
tests.version = testers.testVersion {
package = k9s;
command = "HOME=$(mktemp -d) k9s version -s";
inherit (finalAttrs) version;
};
updateScript = nix-update-script { };
};
nativeBuildInputs = [
installShellFiles
makeWrapper
];
postInstall = ''
# k9s requires a writeable log directory
# Otherwise an error message is printed
# into the completion scripts
export K9S_LOGS_DIR=$(mktemp -d)
installShellCompletion --cmd k9s \
--bash <($out/bin/k9s completion bash) \
--fish <($out/bin/k9s completion fish) \
--zsh <($out/bin/k9s completion zsh)
wrapProgram $out/bin/k9s \
--suffix PATH : "${
lib.makeBinPath [
kubectl
]
}"
mkdir -p $out/share/k9s/skins
cp -r $src/skins/* $out/share/k9s/skins/
'';
nativeCheckInputs = [ writableTmpDirAsHomeHook ];
meta = {
description = "Kubernetes CLI To Manage Your Clusters In Style";
homepage = "https://github.com/derailed/k9s";
changelog = "https://github.com/derailed/k9s/releases/tag/v${finalAttrs.version}";
license = lib.licenses.asl20;
mainProgram = "k9s";
maintainers = with lib.maintainers; [
markus1189
qjoly
devusb
ryan4yin
];
};
})
|