1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-26 20:01:15 +02:00

* Move the implementation of the ‘derivation’ primop into a separate

file.
This commit is contained in:
Eelco Dolstra 2012-01-03 14:01:47 +00:00
parent 6c31232e14
commit 921111d197
4 changed files with 35 additions and 26 deletions

View file

@ -1099,29 +1099,7 @@ void EvalState::createBaseEnv()
/* Add a wrapper around the derivation primop that computes the
`drvPath' and `outPath' attributes lazily. */
string s = "attrs: \
let \
strict = derivationStrict attrs; \
attrValues = attrs: \
map (name: builtins.getAttr name attrs) (builtins.attrNames attrs); \
outputToAttrListElement = output: \
{ \
name = output; \
value = attrs // { \
outPath = builtins.getAttr (output + \"Path\") strict; \
drvPath = strict.drvPath; \
type = \"derivation\"; \
currentOutput = output; \
} // outputsAttrs // { all = allList; }; \
}; \
outputsList = if attrs ? outputs then \
map outputToAttrListElement attrs.outputs else \
[ (outputToAttrListElement \"out\") ]; \
outputsAttrs = builtins.listToAttrs outputsList; \
allList = attrValues outputsAttrs; \
head = if attrs ? outputs then builtins.head attrs.outputs else \"out\"; \
in builtins.getAttr head outputsAttrs";
mkThunk_(v, parseExprFromString(s, "/"));
mkThunk_(v, parseExprFromFile(findFile("nix/derivation.nix")));
addConstant("derivation", v);
/* Now that we've added all primops, sort the `builtins' attribute