Add a helper binary package utility

This commit is contained in:
Jeremy Wall 2022-05-24 20:22:53 -04:00
parent 3c6e7fb246
commit f9953c9f98

21
nix/lib/binary.nix Normal file
View File

@ -0,0 +1,21 @@
{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}
'';
}