nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 buildGoModule,
3 fetchFromGitHub,
4 lib,
5 installShellFiles,
6}:
7
8buildGoModule rec {
9 pname = "tanka";
10 version = "0.33.0";
11
12 src = fetchFromGitHub {
13 owner = "grafana";
14 repo = "tanka";
15 rev = "v${version}";
16 sha256 = "sha256-B4ebheUeBf1E/bdwSZoMiMCAmbbuBki6EBn6ZDT4ocM=";
17 };
18
19 vendorHash = "sha256-I8acIMTxn7w+b9Z/4TxycQZp1LK7CphtTPOZFcfoEvU=";
20
21 doCheck = false;
22 # Required for versions >= 0.28 as they introduce a gowork.sum file. This is only used for tests so we can safely disable GOWORK
23 env.GOWORK = "off";
24
25 subPackages = [ "cmd/tk" ];
26
27 ldflags = [
28 "-s"
29 "-w"
30 "-extldflags '-static'"
31 "-X github.com/grafana/tanka/pkg/tanka.CurrentVersion=v${version}"
32 ];
33
34 nativeBuildInputs = [ installShellFiles ];
35
36 postInstall = ''
37 echo "complete -C $out/bin/tk tk" > tk.bash
38
39 cat >tk.fish <<EOF
40
41 function __complete_tk
42 set -lx COMP_LINE (commandline -cp)
43 test -z (commandline -ct)
44 and set COMP_LINE "\$COMP_LINE "
45 $out/bin/tk
46 end
47 complete -f -c tk -a "(__complete_tk)"
48
49 EOF
50
51 cat >tk.zsh <<EOF
52 #compdef tk
53 autoload -U +X bashcompinit && bashcompinit
54 complete -o nospace -C $out/bin/tk tk
55 EOF
56
57 installShellCompletion \
58 --cmd tk \
59 --bash tk.bash \
60 --fish tk.fish \
61 --zsh tk.zsh
62 '';
63
64 meta = with lib; {
65 description = "Flexible, reusable and concise configuration for Kubernetes";
66 homepage = "https://tanka.dev";
67 license = licenses.asl20;
68 maintainers = with maintainers; [ mikefaille ];
69 mainProgram = "tk";
70 };
71}