summary refs log tree commit diff
path: root/pkgs/applications/networking/cluster
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/networking/cluster')
-rw-r--r--pkgs/applications/networking/cluster/docker-machine/default.nix14
-rw-r--r--pkgs/applications/networking/cluster/kompose/default.nix7
-rw-r--r--pkgs/applications/networking/cluster/kops/default.nix12
-rw-r--r--pkgs/applications/networking/cluster/stern/default.nix12
4 files changed, 24 insertions, 21 deletions
diff --git a/pkgs/applications/networking/cluster/docker-machine/default.nix b/pkgs/applications/networking/cluster/docker-machine/default.nix
index 32108426032..a801a122374 100644
--- a/pkgs/applications/networking/cluster/docker-machine/default.nix
+++ b/pkgs/applications/networking/cluster/docker-machine/default.nix
@@ -1,5 +1,5 @@
 # This file was generated by go2nix.
-{ stdenv, buildGoPackage, fetchFromGitHub }:
+{ stdenv, buildGoPackage, fetchFromGitHub, installShellFiles }:
 
 buildGoPackage rec {
   pname = "machine";
@@ -14,13 +14,13 @@ buildGoPackage rec {
     sha256 = "0xxzxi5v7ji9j2k7kxhi0ah91lfa7b9rg3nywgx0lkv8dlgp8kmy";
   };
 
-  postInstall = ''
-    mkdir -p \
-      $bin/share/bash-completion/completions/ \
-      $bin/share/zsh/site-functions/
+  nativeBuildInputs = [ installShellFiles ];
 
-    cp go/src/github.com/docker/machine/contrib/completion/bash/* $bin/share/bash-completion/completions/
-    cp go/src/github.com/docker/machine/contrib/completion/zsh/* $bin/share/zsh/site-functions/
+  postInstall = ''
+    pushd go/src/${goPackagePath}/contrib/completion
+    installShellCompletion --bash bash/*
+    installShellCompletion --zsh zsh/*
+    popd
   '';
 
   meta = with stdenv.lib; {
diff --git a/pkgs/applications/networking/cluster/kompose/default.nix b/pkgs/applications/networking/cluster/kompose/default.nix
index 09a69f4b80e..2467ed93b32 100644
--- a/pkgs/applications/networking/cluster/kompose/default.nix
+++ b/pkgs/applications/networking/cluster/kompose/default.nix
@@ -15,9 +15,10 @@ buildGoPackage rec {
 
   nativeBuildInputs = [ installShellFiles ];
   postInstall = ''
-    $bin/bin/kompose completion bash > kompose.bash
-    $bin/bin/kompose completion zsh > kompose.zsh
-    installShellCompletion kompose.{bash,zsh}
+    for shell in bash zsh; do
+      $bin/bin/kompose completion $shell > kompose.$shell
+      installShellCompletion kompose.$shell
+    done
   '';
 
   meta = with lib; {
diff --git a/pkgs/applications/networking/cluster/kops/default.nix b/pkgs/applications/networking/cluster/kops/default.nix
index a5f1806e577..4d2e406c040 100644
--- a/pkgs/applications/networking/cluster/kops/default.nix
+++ b/pkgs/applications/networking/cluster/kops/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, buildGoPackage, fetchFromGitHub, go-bindata }:
+{ stdenv, lib, buildGoPackage, fetchFromGitHub, go-bindata, installShellFiles }:
 
 let
   goPackagePath = "k8s.io/kops";
@@ -18,7 +18,7 @@ let
           inherit sha256;
         };
 
-        nativeBuildInputs = [ go-bindata ];
+        nativeBuildInputs = [ go-bindata installShellFiles ];
         subPackages = [ "cmd/kops" ];
 
         buildFlagsArray = ''
@@ -33,10 +33,10 @@ let
         '';
 
         postInstall = ''
-          mkdir -p $bin/share/bash-completion/completions
-          mkdir -p $bin/share/zsh/site-functions
-          $bin/bin/kops completion bash > $bin/share/bash-completion/completions/kops
-          $bin/bin/kops completion zsh > $bin/share/zsh/site-functions/_kops
+          for shell in bash zsh; do
+            $bin/bin/kops completion $shell > kops.$shell
+            installShellCompletion kops.$shell
+          done
         '';
 
         meta = with stdenv.lib; {
diff --git a/pkgs/applications/networking/cluster/stern/default.nix b/pkgs/applications/networking/cluster/stern/default.nix
index 144d46043ff..95ad965c346 100644
--- a/pkgs/applications/networking/cluster/stern/default.nix
+++ b/pkgs/applications/networking/cluster/stern/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, buildPackages, buildGoPackage, fetchFromGitHub }:
+{ stdenv, lib, buildPackages, buildGoPackage, fetchFromGitHub, installShellFiles }:
 
 let isCrossBuild = stdenv.hostPlatform != stdenv.buildPlatform; in
 
@@ -17,13 +17,15 @@ buildGoPackage rec {
 
   goDeps = ./deps.nix;
 
+  nativeBuildInputs = [ installShellFiles ];
+
   postInstall =
     let stern = if isCrossBuild then buildPackages.stern else "$bin"; in
     ''
-      mkdir -p $bin/share/bash-completion/completions
-      ${stern}/bin/stern --completion bash > $bin/share/bash-completion/completions/stern
-      mkdir -p $bin/share/zsh/site-functions
-      ${stern}/bin/stern --completion zsh > $bin/share/zsh/site-functions/_stern
+      for shell in bash zsh; do
+        ${stern}/bin/stern --completion $shell > stern.$shell
+        installShellCompletion stern.$shell
+      done
     '';
 
   meta = with lib; {