easy-dhall-nix/build.nix
Profpatsch 5b7632cbc4 fix(dhall-to-yaml-ng): fix completion
The completion was pointing to an executable that did not exist in
that output, the suffix `-ng` was missing.
2020-08-04 21:30:56 +02:00

30 lines
714 B
Nix

{ pkgs, release }:
{ simpleName, binName, attrName }:
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;
};
installPhase = ''
mkdir -p $out/bin
binPath="$out/bin/${binName}"
install -D -m555 -T ${binName} "$binPath"
mkdir -p $out/etc/bash_completion.d/
"$binPath" --bash-completion-script "$binPath" > "$out/etc/bash_completion.d/${binName}-completion.bash"
'';
}