dotfiles/nix/lib/binary.nix

21 lines
488 B
Nix
Raw Normal View History

2022-05-24 20:22:53 -04:00
{pkgs, patchElf ? false, name, url, sha256 ? "0000000000000000000000000000000000000000000000000000"}:
with pkgs;
stdenv.mkDerivation {
inherit name;
src = fetchurl {
url = url;
sha256 = sha256;
};
nativeBuildInputs = [
] ++ lib.optionals patchElf [
autoPatchelfHook
];
phases = ["installPhase" "fixupPhase"];
installPhase = ''
mkdir -p $out/bin
cp $src $out/bin/${name}
chmod u+x $out/bin/${name}
'';
}