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; { diff --git a/pkgs/applications/networking/sync/rclone/default.nix b/pkgs/applications/networking/sync/rclone/default.nix index 2f484467450..57925a3292d 100644 --- a/pkgs/applications/networking/sync/rclone/default.nix +++ b/pkgs/applications/networking/sync/rclone/default.nix @@ -1,4 +1,4 @@ -{ stdenv, buildGoPackage, fetchFromGitHub, buildPackages }: +{ stdenv, buildGoPackage, fetchFromGitHub, buildPackages, installShellFiles }: buildGoPackage rec { pname = "rclone"; @@ -17,6 +17,8 @@ buildGoPackage rec { outputs = [ "bin" "out" "man" ]; + nativeBuildInputs = [ installShellFiles ]; + postInstall = let rcloneBin = @@ -25,10 +27,11 @@ buildGoPackage rec { else stdenv.lib.getBin buildPackages.rclone; in '' - install -D -m644 $src/rclone.1 $man/share/man/man1/rclone.1 - mkdir -p $bin/share/zsh/site-functions $bin/share/bash-completion/completions/ - ${rcloneBin}/bin/rclone genautocomplete zsh $bin/share/zsh/site-functions/_rclone - ${rcloneBin}/bin/rclone genautocomplete bash $bin/share/bash-completion/completions/rclone.bash + installManPage $src/rclone.1 + for shell in bash zsh; do + ${rcloneBin}/bin/rclone genautocomplete $shell rclone.$shell + installShellCompletion rclone.$shell + done ''; meta = with stdenv.lib; { diff --git a/pkgs/applications/version-management/git-and-tools/hub/default.nix b/pkgs/applications/version-management/git-and-tools/hub/default.nix index 8890cd5eb23..9dbb497c8c9 100644 --- a/pkgs/applications/version-management/git-and-tools/hub/default.nix +++ b/pkgs/applications/version-management/git-and-tools/hub/default.nix @@ -1,4 +1,4 @@ -{ stdenv, buildGoPackage, fetchFromGitHub, groff, utillinux }: +{ stdenv, buildGoPackage, fetchFromGitHub, groff, installShellFiles, utillinux }: buildGoPackage rec { pname = "hub"; @@ -16,7 +16,7 @@ buildGoPackage rec { sha256 = "1qjab3dpia1jdlszz3xxix76lqrm4zbmqzd9ymld7h06awzsg2vh"; }; - nativeBuildInputs = [ groff utillinux ]; + nativeBuildInputs = [ groff installShellFiles utillinux ]; postPatch = '' patchShebangs . @@ -24,13 +24,13 @@ buildGoPackage rec { postInstall = '' cd go/src/${goPackagePath} - install -D etc/hub.zsh_completion "$bin/share/zsh/site-functions/_hub" - install -D etc/hub.bash_completion.sh "$bin/share/bash-completion/completions/hub" - install -D etc/hub.fish_completion "$bin/share/fish/vendor_completions.d/hub.fish" + installShellCompletion --zsh --name _hub etc/hub.zsh_completion + installShellCompletion --bash --name hub etc/hub.bash_completion.sh + installShellCompletion --fish --name hub.fish etc/hub.fish_completion LC_ALL=C.UTF8 \ make man-pages - cp -vr --parents share/man/man[1-9]/*.[1-9] $bin/ + installManPage share/man/man[1-9]/*.[1-9] ''; meta = with stdenv.lib; { diff --git a/pkgs/development/go-packages/generic/default.nix b/pkgs/development/go-packages/generic/default.nix index 388280a905f..b4ec8bd1706 100644 --- a/pkgs/development/go-packages/generic/default.nix +++ b/pkgs/development/go-packages/generic/default.nix @@ -242,11 +242,7 @@ let # Add default meta information homepage = "https://${goPackagePath}"; platforms = go.meta.platforms or lib.platforms.all; - } // meta // { - # add an extra maintainer to every package - maintainers = (meta.maintainers or []) ++ - [ lib.maintainers.lethalman ]; - }; + } // meta; }); in if disabled then throw "${package.name} not supported for go ${go.meta.branch}" diff --git a/pkgs/development/tools/kind/default.nix b/pkgs/development/tools/kind/default.nix index f86bc489837..6436c83ee21 100644 --- a/pkgs/development/tools/kind/default.nix +++ b/pkgs/development/tools/kind/default.nix @@ -19,9 +19,10 @@ buildGoPackage rec { nativeBuildInputs = [ installShellFiles ]; postInstall = '' - $bin/bin/kind completion bash > kind.bash - $bin/bin/kind completion zsh > kind.zsh - installShellCompletion kind.{bash,zsh} + for shell in bash zsh; do + $bin/bin/kind completion $shell > kind.$shell + installShellCompletion kind.$shell + done ''; meta = { diff --git a/pkgs/servers/monitoring/prometheus/mail-exporter.nix b/pkgs/servers/monitoring/prometheus/mail-exporter.nix index 1e29eefba2b..f845a6ef256 100644 --- a/pkgs/servers/monitoring/prometheus/mail-exporter.nix +++ b/pkgs/servers/monitoring/prometheus/mail-exporter.nix @@ -1,4 +1,4 @@ -{ stdenv, buildGoPackage, fetchFromGitHub }: +{ stdenv, buildGoPackage, fetchFromGitHub, installShellFiles }: buildGoPackage { pname = "mailexporter"; @@ -15,9 +15,11 @@ buildGoPackage { goDeps = ./mail-exporter_deps.nix; + nativeBuildInputs = [ installShellFiles ]; + postInstall = '' - install -D -m 0444 -t $bin/share/man/man1 $src/man/mailexporter.1 - install -D -m 0444 -t $bin/share/man/man5 $src/man/mailexporter.conf.5 + installManPage $src/man/mailexporter.1 + installManPage $src/man/mailexporter.conf.5 ''; meta = with stdenv.lib; { diff --git a/pkgs/servers/sql/cockroachdb/default.nix b/pkgs/servers/sql/cockroachdb/default.nix index 8f3d2a7b285..fb62ee58474 100644 --- a/pkgs/servers/sql/cockroachdb/default.nix +++ b/pkgs/servers/sql/cockroachdb/default.nix @@ -1,6 +1,7 @@ { stdenv, buildGoPackage, fetchurl , cmake, xz, which, autoconf , ncurses6, libedit, libunwind +, installShellFiles }: let @@ -8,7 +9,7 @@ let linuxDeps = [ ncurses6 ]; buildInputs = if stdenv.isDarwin then darwinDeps else linuxDeps; - nativeBuildInputs = [ cmake xz which autoconf ]; + nativeBuildInputs = [ installShellFiles cmake xz which autoconf ]; in buildGoPackage rec { @@ -42,7 +43,7 @@ buildGoPackage rec { runHook preInstall install -D cockroachoss $bin/bin/cockroach - install -D cockroach.bash $bin/share/bash-completion/completions/cockroach.bash + installShellCompletion cockroach.bash mkdir -p $man/share/man cp -r man $man/share/man diff --git a/pkgs/tools/admin/lxd/default.nix b/pkgs/tools/admin/lxd/default.nix index 19fbff747fc..6051c16e91e 100644 --- a/pkgs/tools/admin/lxd/default.nix +++ b/pkgs/tools/admin/lxd/default.nix @@ -5,6 +5,7 @@ , writeShellScriptBin, apparmor-profiles, apparmor-parser , criu , bash +, installShellFiles }: buildGoPackage rec { @@ -39,11 +40,10 @@ buildGoPackage rec { '') ]} - mkdir -p "$bin/share/bash-completion/completions/" - cp -av go/src/github.com/lxc/lxd/scripts/bash/lxd-client "$bin/share/bash-completion/completions/lxc" + installShellCompletion --bash go/src/github.com/lxc/lxd/scripts/bash/lxd-client ''; - nativeBuildInputs = [ pkgconfig makeWrapper ]; + nativeBuildInputs = [ installShellFiles pkgconfig makeWrapper ]; buildInputs = [ lxc acl libcap libco-canonical.dev dqlite.dev raft-canonical.dev sqlite-replication udev.dev ]; diff --git a/pkgs/tools/security/gopass/default.nix b/pkgs/tools/security/gopass/default.nix index 8af24bf7ab5..cb640fb1639 100644 --- a/pkgs/tools/security/gopass/default.nix +++ b/pkgs/tools/security/gopass/default.nix @@ -1,4 +1,4 @@ -{ stdenv, buildGoPackage, fetchFromGitHub, git, gnupg, xclip, wl-clipboard, makeWrapper }: +{ stdenv, buildGoPackage, fetchFromGitHub, git, gnupg, xclip, wl-clipboard, installShellFiles, makeWrapper }: buildGoPackage rec { pname = "gopass"; @@ -6,7 +6,7 @@ buildGoPackage rec { goPackagePath = "github.com/gopasspw/gopass"; - nativeBuildInputs = [ makeWrapper ]; + nativeBuildInputs = [ installShellFiles makeWrapper ]; src = fetchFromGitHub { owner = "gopasspw"; @@ -22,13 +22,10 @@ buildGoPackage rec { ] ++ stdenv.lib.optional stdenv.isLinux wl-clipboard); postInstall = '' - mkdir -p \ - $bin/share/bash-completion/completions \ - $bin/share/zsh/site-functions \ - $bin/share/fish/vendor_completions.d - $bin/bin/gopass completion bash > $bin/share/bash-completion/completions/_gopass - $bin/bin/gopass completion zsh > $bin/share/zsh/site-functions/_gopass - $bin/bin/gopass completion fish > $bin/share/fish/vendor_completions.d/gopass.fish + for shell in bash fish zsh; do + $bin/bin/gopass completion $shell > gopass.$shell + installShellCompletion gopass.$shell + done ''; postFixup = '' diff --git a/pkgs/tools/security/vault/default.nix b/pkgs/tools/security/vault/default.nix index 54be477cfe2..ae46bbae40a 100644 --- a/pkgs/tools/security/vault/default.nix +++ b/pkgs/tools/security/vault/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchFromGitHub, buildGoPackage }: +{ stdenv, fetchFromGitHub, buildGoPackage, installShellFiles }: buildGoPackage rec { pname = "vault"; @@ -15,14 +15,16 @@ buildGoPackage rec { subPackages = [ "." ]; + nativeBuildInputs = [ installShellFiles ]; + buildFlagsArray = [ "-tags='vault'" "-ldflags=\"-X github.com/hashicorp/vault/sdk/version.GitCommit='v${version}'\"" ]; postInstall = '' - mkdir -p $bin/share/bash-completion/completions - echo "complete -C $bin/bin/vault vault" > $bin/share/bash-completion/completions/vault + echo "complete -C $bin/bin/vault vault" > vault.bash + installShellCompletion vault.bash ''; meta = with stdenv.lib; {