forked from rarias/bscpkgs
Provide argvWrapper
This commit is contained in:
25
bsc/garlic/argv.nix
Normal file
25
bsc/garlic/argv.nix
Normal 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
|
||||
'';
|
||||
}
|
||||
Reference in New Issue
Block a user