2012-01-04 11:04:19 +00:00
|
|
|
|
/* This is the implementation of the ‘derivation’ builtin function.
|
|
|
|
|
It's actually a wrapper around the ‘derivationStrict’ primop. */
|
|
|
|
|
|
|
|
|
|
drvAttrs @ { outputs ? [ "out" ], ... }:
|
2012-01-03 14:01:47 +00:00
|
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
2012-01-04 11:04:19 +00:00
|
|
|
|
strict = derivationStrict drvAttrs;
|
2012-01-03 14:01:47 +00:00
|
|
|
|
|
2012-01-04 11:56:15 +00:00
|
|
|
|
commonAttrs = drvAttrs // (builtins.listToAttrs outputsList) //
|
|
|
|
|
{ all = map (x: x.value) outputsList;
|
|
|
|
|
inherit drvAttrs;
|
|
|
|
|
};
|
2012-01-04 11:04:19 +00:00
|
|
|
|
|
2012-01-03 15:27:18 +00:00
|
|
|
|
outputToAttrListElement = outputName:
|
|
|
|
|
{ name = outputName;
|
2012-01-04 11:04:19 +00:00
|
|
|
|
value = commonAttrs // {
|
2012-01-03 15:27:18 +00:00
|
|
|
|
outPath = builtins.getAttr outputName strict;
|
2012-01-03 14:01:47 +00:00
|
|
|
|
drvPath = strict.drvPath;
|
|
|
|
|
type = "derivation";
|
2012-01-04 12:00:39 +00:00
|
|
|
|
inherit outputName;
|
2012-01-04 11:04:19 +00:00
|
|
|
|
};
|
2012-01-03 14:01:47 +00:00
|
|
|
|
};
|
|
|
|
|
|
2012-01-04 11:04:19 +00:00
|
|
|
|
outputsList = map outputToAttrListElement outputs;
|
2012-01-03 14:01:47 +00:00
|
|
|
|
|
2012-01-04 11:04:19 +00:00
|
|
|
|
in (builtins.head outputsList).value
|