flake/pkgs/scripts/makeScript.nix

22 lines
428 B
Nix
Raw Normal View History

2024-03-02 12:50:51 +00:00
{
lib,
runtimeShell,
writeScriptBin,
2024-06-18 00:59:05 +00:00
runCommandNoCCLocal,
makeBinaryWrapper,
2024-03-02 12:50:51 +00:00
}: {
name,
file,
runtimeInputs ? [],
}:
2024-06-18 00:59:05 +00:00
# FIXME: incorrect argv0
runCommandNoCCLocal name {
src = file;
nativeBuildInputs = [makeBinaryWrapper];
} ''
install -Dm755 $src $out/bin/.$name
makeBinaryWrapper ${runtimeShell} $out/bin/$name \
--add-flags $out/bin/.$name \
--prefix PATH : ${lib.makeBinPath runtimeInputs}
2024-03-02 12:50:51 +00:00
''