diff options
Diffstat (limited to 'pkgs/profpatsch/execline/run-execline.nix')
-rw-r--r-- | pkgs/profpatsch/execline/run-execline.nix | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/pkgs/profpatsch/execline/run-execline.nix b/pkgs/profpatsch/execline/run-execline.nix new file mode 100644 index 00000000..40915f25 --- /dev/null +++ b/pkgs/profpatsch/execline/run-execline.nix @@ -0,0 +1,38 @@ +{ stdenv, importasCommand, execlinebCommand }: +{ name +# the execline script +, execline +# additional arguments to pass to the derivation +, derivationArgs ? {} +}: + +# those arguments can’t be overwritten +assert !derivationArgs ? system; +assert !derivationArgs ? name; +assert !derivationArgs ? builder; +assert !derivationArgs ? args; + +derivation (derivationArgs // { + inherit (stdenv) system; + inherit name; + + # okay, `builtins.toFile` does not accept strings + # that reference drv outputs. This means we need + # to pass the script as envvar; + # this might clash with another passed envar, + # so we give it a long & unique name + _runExeclineScript = execline; + passAsFile = [ "_runExeclineScript" ] + ++ derivationArgs.passAsFile or []; + + builder = importasCommand; + args = [ + "-ui" # drop the envvar afterwards + "script" # substitution name + "_runExeclineScriptPath" # passed script file + execlinebCommand # the actual invocation + "-P" # ignore command line arguments + "-W" # die on syntax error + "$script" # substituted by importas + ]; +}) |