flake/pkgs/scripts/makeScript.nix

21 lines
410 B
Nix
Raw Normal View History

2024-03-02 12:50:51 +00:00
{
lib,
runtimeShell,
2024-06-18 00:59:05 +00:00
runCommandNoCCLocal,
makeBinaryWrapper,
2024-03-02 12:50:51 +00:00
}: {
name,
2024-06-18 01:42:20 +00:00
src,
2024-03-02 12:50:51 +00:00
runtimeInputs ? [],
}:
2024-06-18 00:59:05 +00:00
# FIXME: incorrect argv0
runCommandNoCCLocal name {
2024-06-18 01:42:20 +00:00
inherit src;
2024-06-18 00:59:05 +00:00
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
''