Archived
1
0
forked from rarias/bscpkgs

Provide argvWrapper

This commit is contained in:
2020-08-12 14:00:04 +02:00
parent 338736d257
commit df18435dfc
6 changed files with 122 additions and 42 deletions

25
bsc/garlic/argv.nix Normal file
View File

@@ -0,0 +1,25 @@
{
stdenv
}:
{
app
, argv # bash array as string, example: argv=''(-f "file with spaces" -t 10)''
}:
stdenv.mkDerivation {
inherit argv;
name = "${app.name}-argv";
preferLocalBuild = true;
phases = [ "installPhase" ];
dontPatchShebangs = true;
installPhase = ''
mkdir -p $out/bin
cat > $out/bin/run <<EOF
#!/bin/sh
argv=${argv}
exec ${app}/bin/run \''${argv[@]}
EOF
chmod +x $out/bin/run
'';
}