mirror of
https://github.com/justinwoo/easy-dhall-nix.git
synced 2024-11-14 23:29:41 +01:00
e207b5c2c6
The files are very self-similar, and provided upstream doesn’t do something completely crazy, they should stay that way. dhall-json is more complicated, and it wasn’t worth it implemented something more complicated in build.nix, so for now it stays the same.
30 lines
747 B
Nix
30 lines
747 B
Nix
{ pkgs, release }:
|
|
|
|
{ simpleName, binName, attrName, completionName ? binName }:
|
|
|
|
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/${completionName}-completion.bash"
|
|
'';
|
|
}
|