summary refs log tree commit diff
path: root/pkgs/development/tools/kubectx/default.nix
blob: 5cf0badf668e2e47d96667cd5c651cb43ec919a2 (plain) (blame)
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
{ stdenv, lib, fetchFromGitHub, kubectl, makeWrapper }:

with lib;

stdenv.mkDerivation rec {
  name = "kubectx";
  version = "0.5.1";

  src = fetchFromGitHub {
    owner = "ahmetb";
    repo = "${name}";
    rev = "v${version}";
    sha256 = "1bmmaj5fffx4hy55l6x4vl5gr9rp2yhg4vs5b9sya9rjvdkamdx5";
  };

  buildInputs = [ makeWrapper ];

  dontBuild = true;
  doCheck = false;

  installPhase = ''
    mkdir -p $out/bin
    cp kubectx $out/bin
    cp kubens $out/bin

    for f in $out/bin/*; do
      wrapProgram $f --prefix PATH : ${makeBinPath [ kubectl ]}
    done
  '';

  meta = {
    description = "Fast way to switch between clusters and namespaces in kubectl!";
    license = licenses.asl20;
    homepage = https://github.com/ahmetb/kubectx;
    maintainers = with maintainers; [ periklis ];
    platforms = with platforms; unix;
  };
}