Skip to content

Instantly share code, notes, and snippets.

@matthew-piziak
Created November 18, 2018 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthew-piziak/bd37fde51cd56ea3febbb9d7b2089750 to your computer and use it in GitHub Desktop.
Save matthew-piziak/bd37fde51cd56ea3febbb9d7b2089750 to your computer and use it in GitHub Desktop.
/* This is the implementation of the ‘derivation’ builtin function.
It's actually a wrapper around the ‘derivationStrict’ primop. */
drvAttrs @ { outputs ? [ "out" ], ... }:
let
strict = derivationStrict drvAttrs;
commonAttrs = drvAttrs // (builtins.listToAttrs outputsList) //
{ all = map (x: x.value) outputsList;
inherit drvAttrs;
};
outputToAttrListElement = outputName:
{ name = outputName;
value = commonAttrs // {
outPath = builtins.getAttr outputName strict; -- <- this is 18:9
drvPath = strict.drvPath;
type = "derivation";
inherit outputName;
};
};
outputsList = map outputToAttrListElement outputs;
in (builtins.head outputsList).value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment