diff options
author | Profpatsch <mail@profpatsch.de> | 2018-07-25 03:11:41 +0200 |
---|---|---|
committer | Profpatsch <mail@profpatsch.de> | 2018-07-25 03:17:14 +0200 |
commit | 097307c46fc5a7bda63a5916cfd1ee3ad661a0a6 (patch) | |
tree | 21aad88f5d534f3546e3d3a6b43ed64c2d275c6e /pkgs/profpatsch/execline/run-execline.nix | |
parent | fd8db354af44cfd2142186c762d2c280c0639233 (diff) |
pkgs/profpatsch: WIP execline experiments
* runExecline: like runCommand, but a lot more lightweight * symlink: symlink a given list of links together * importer: a small DSL to “import” “modules” into a build context Some highlights: * runExecline does not use any stdenv (apart from the `execline` build) * symlink uses netstrings to pass correct fields into the derivation * no use of bash, everything uses execline.
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 + ]; +}) |