flake/pkgs/scripts/makeScript.nix

22 lines
429 B
Nix
Raw Normal View History

2024-03-02 12:50:51 +00:00
{
lib,
runtimeShell,
runCommandLocal,
2024-06-18 00:59:05 +00:00
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
runCommandLocal name {
2024-06-18 01:42:20 +00:00
inherit src;
2024-06-18 00:59:05 +00:00
nativeBuildInputs = [makeBinaryWrapper];
2024-06-23 10:03:14 +00:00
meta.mainProgram = name;
2024-06-18 00:59:05 +00:00
} ''
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
''