stern: use installShellFiles

This commit is contained in:
zowoq 2020-04-26 13:16:52 +10:00
parent 16df60734a
commit 954eab8ea9

View File

@ -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; {