diff options
-rw-r--r-- | lib/customisation.nix | 17 | ||||
-rw-r--r-- | lib/default.nix | 3 |
2 files changed, 15 insertions, 5 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 diff --git a/lib/default.nix b/lib/default.nix index 9dc4fea99fc..b304eb62bb2 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -87,7 +87,8 @@ let inherit (stringsWithDeps) textClosureList textClosureMap noDepEntry fullDepEntry packEntry stringAfter; inherit (customisation) overrideDerivation makeOverridable - callPackageWith callPackagesWith addPassthru hydraJob makeScope; + callPackageWith callPackagesWith extendDerivation addPassthru + hydraJob makeScope; inherit (meta) addMetaAttrs dontDistribute setName updateName appendToName mapDerivationAttrset lowPrio lowPrioSet hiPrio hiPrioSet; |