2020-08-04 20:56:48 +02:00
|
|
|
{ pkgs, release }:
|
|
|
|
|
2020-08-04 21:18:26 +02:00
|
|
|
{ simpleName, binName, attrName }:
|
2020-08-04 20:56:48 +02:00
|
|
|
|
|
|
|
let
|
|
|
|
release = import ./release.nix;
|
|
|
|
in
|
|
|
|
|
|
|
|
pkgs.stdenv.mkDerivation rec {
|
|
|
|
name = simpleName;
|
|
|
|
|
|
|
|
src = if pkgs.stdenv.isDarwin
|
|
|
|
then pkgs.fetchzip {
|
|
|
|
url = release.${"${attrName}-darwin"}.url;
|
|
|
|
sha256 = release.${"${attrName}-darwin"}.hash;
|
|
|
|
}
|
|
|
|
else pkgs.fetchzip {
|
|
|
|
url = release.${"${attrName}-linux"}.url;
|
|
|
|
sha256 = release.${"${attrName}-linux"}.hash;
|
|
|
|
};
|
|
|
|
|
2020-08-04 21:47:05 +02:00
|
|
|
nativeBuildInputs = [ pkgs.installShellFiles ];
|
|
|
|
|
2020-08-04 20:56:48 +02:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
binPath="$out/bin/${binName}"
|
|
|
|
install -D -m555 -T ${binName} "$binPath"
|
|
|
|
|
2020-08-04 21:47:05 +02:00
|
|
|
"$binPath" --bash-completion-script "$binPath" > "${binName}.bash"
|
|
|
|
installShellCompletion --bash "${binName}.bash"
|
|
|
|
"$binPath" --zsh-completion-script "$binPath" > "${binName}.zsh"
|
|
|
|
installShellCompletion --zsh "${binName}.zsh"
|
|
|
|
"$binPath" --fish-completion-script "$binPath" > "${binName}.fish"
|
|
|
|
installShellCompletion --fish "${binName}.fish"
|
2020-08-04 20:56:48 +02:00
|
|
|
'';
|
|
|
|
}
|