diff options
author | Jan Malakhovski <oxij@oxij.org> | 2017-12-25 18:06:49 +0000 |
---|---|---|
committer | Jan Malakhovski <oxij@oxij.org> | 2018-01-03 12:20:24 +0000 |
commit | b1ca8517ee54b89c24c77af3b9408066cee57d74 (patch) | |
tree | a1d08be615a882e07520940bf5d3dc9d16296850 /lib/customisation.nix | |
parent | eb6db32d015397f24bd623a60e7e53e37ffe2258 (diff) | |
download | nixpkgs-b1ca8517ee54b89c24c77af3b9408066cee57d74.tar nixpkgs-b1ca8517ee54b89c24c77af3b9408066cee57d74.tar.gz nixpkgs-b1ca8517ee54b89c24c77af3b9408066cee57d74.tar.bz2 nixpkgs-b1ca8517ee54b89c24c77af3b9408066cee57d74.tar.lz nixpkgs-b1ca8517ee54b89c24c77af3b9408066cee57d74.tar.xz nixpkgs-b1ca8517ee54b89c24c77af3b9408066cee57d74.tar.zst nixpkgs-b1ca8517ee54b89c24c77af3b9408066cee57d74.zip |
lib: generalize `addPassthru` to `extendDerivation`
Diffstat (limited to 'lib/customisation.nix')
-rw-r--r-- | lib/customisation.nix | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/customisation.nix b/lib/customisation.nix index 483ef6fd486..84f7783a6aa 100644 --- a/lib/customisation.nix +++ b/lib/customisation.nix @@ -131,8 +131,8 @@ rec { /* Add attributes to each output of a derivation without changing - the derivation itself. */ - addPassthru = drv: passthru: + the derivation itself and check a given condition when evaluating. */ + extendDerivation = condition: passthru: drv: let outputs = drv.outputs or [ "out" ]; @@ -142,13 +142,22 @@ rec { outputToAttrListElement = outputName: { name = outputName; value = commonAttrs // { - inherit (drv.${outputName}) outPath drvPath type outputName; + inherit (drv.${outputName}) type outputName; + drvPath = assert condition; drv.${outputName}.drvPath; + outPath = assert condition; drv.${outputName}.outPath; }; }; outputsList = map outputToAttrListElement outputs; - in commonAttrs // { outputUnspecified = true; }; + in commonAttrs // { + outputUnspecified = true; + drvPath = assert condition; drv.drvPath; + outPath = assert condition; drv.outPath; + }; + /* Add attributes to each output of a derivation without changing + the derivation itself. */ + addPassthru = drv: passthru: extendDerivation true passthru drv; /* Strip a derivation of all non-essential attributes, returning only those needed by hydra-eval-jobs. Also strictly evaluate the |