flake/pkgs/scripts/makeScript.nix

21 lines
428 B
Nix

{
lib,
runtimeShell,
writeScriptBin,
runCommandNoCCLocal,
makeBinaryWrapper,
}: {
name,
src,
runtimeInputs ? [],
}:
# FIXME: incorrect argv0
runCommandNoCCLocal name {
inherit src;
nativeBuildInputs = [makeBinaryWrapper];
} ''
install -Dm755 $src $out/bin/.$name
makeBinaryWrapper ${runtimeShell} $out/bin/$name \
--add-flags $out/bin/.$name \
--prefix PATH : ${lib.makeBinPath runtimeInputs}
''