summary refs log tree commit diff
diff options
context:
space:
mode:
authorJosé Luis Lafuente <jl@lafuente.me>2020-06-12 18:19:54 +0200
committerJosé Luis Lafuente <jl@lafuente.me>2020-06-13 10:10:46 +0200
commita89e9a2eecaf9c77a16f68fc93ef4c791dfafa63 (patch)
tree5850eba991dcd8c72fd6ffb15fb350d7a6c75935
parentb47873026c7e356a340d0e1de7789d4e8428ac66 (diff)
downloadnixpkgs-a89e9a2eecaf9c77a16f68fc93ef4c791dfafa63.tar
nixpkgs-a89e9a2eecaf9c77a16f68fc93ef4c791dfafa63.tar.gz
nixpkgs-a89e9a2eecaf9c77a16f68fc93ef4c791dfafa63.tar.bz2
nixpkgs-a89e9a2eecaf9c77a16f68fc93ef4c791dfafa63.tar.lz
nixpkgs-a89e9a2eecaf9c77a16f68fc93ef4c791dfafa63.tar.xz
nixpkgs-a89e9a2eecaf9c77a16f68fc93ef4c791dfafa63.tar.zst
nixpkgs-a89e9a2eecaf9c77a16f68fc93ef4c791dfafa63.zip
kubectx: re-pack, switch from bash to go
With release 0.9, kubectx was rewritten in go. For more info see
https://github.com/ahmetb/kubectx/releases/tag/v0.9.0
-rw-r--r--pkgs/development/tools/kubectx/default.nix40
1 files changed, 8 insertions, 32 deletions
diff --git a/pkgs/development/tools/kubectx/default.nix b/pkgs/development/tools/kubectx/default.nix
index 8b980dc7e31..b4cbb3cee63 100644
--- a/pkgs/development/tools/kubectx/default.nix
+++ b/pkgs/development/tools/kubectx/default.nix
@@ -1,8 +1,6 @@
-{ stdenv, lib, fetchFromGitHub, kubectl, makeWrapper }:
+{ stdenv, buildGoModule, fetchFromGitHub, installShellFiles }:
 
-with lib;
-
-stdenv.mkDerivation rec {
+buildGoModule rec {
   pname = "kubectx";
   version = "0.9.0";
 
@@ -13,41 +11,19 @@ stdenv.mkDerivation rec {
     sha256 = "1b22jk8zl944w5zn3s7ybkkbmzp9519x32pfqwd1malfly7dzf55";
   };
 
-  buildInputs = [ makeWrapper ];
-
-  dontBuild = true;
-  doCheck = false;
-
-  installPhase = ''
-    mkdir -p $out/bin
-    mkdir -p $out/share/zsh/site-functions
-    mkdir -p $out/share/bash-completion/completions
-    mkdir -p $out/share/fish/vendor_completions.d
-
-    cp kubectx $out/bin
-    cp kubens $out/bin
-
-    # Provide ZSH completions
-    cp completion/kubectx.zsh $out/share/zsh/site-functions/_kubectx
-    cp completion/kubens.zsh $out/share/zsh/site-functions/_kubens
-
-    # Provide BASH completions
-    cp completion/kubectx.bash $out/share/bash-completion/completions/kubectx
-    cp completion/kubens.bash $out/share/bash-completion/completions/kubens
+  vendorSha256 = "168hfdc2rfwpz2ls607bz5vsm1aw4brhwm8hmbiq1n1l2dn2dj0y";
 
-    # Provide FISH completions
-    cp completion/*.fish $out/share/fish/vendor_completions.d/
+  nativeBuildInputs = [ installShellFiles ];
 
-    for f in $out/bin/*; do
-      wrapProgram $f --prefix PATH : ${makeBinPath [ kubectl ]}
-    done
+  postInstall = ''
+    installShellCompletion completion/*
   '';
 
-  meta = {
+  meta = with stdenv.lib; {
     description = "Fast way to switch between clusters and namespaces in kubectl!";
     license = licenses.asl20;
     homepage = "https://github.com/ahmetb/kubectx";
-    maintainers = with maintainers; [ periklis ];
+    maintainers = with maintainers; [ jlesquembre ];
     platforms = with platforms; unix;
   };
 }