diff options
author | Frederik Rietdijk <fridh@fridh.nl> | 2019-01-19 09:24:01 +0100 |
---|---|---|
committer | Frederik Rietdijk <fridh@fridh.nl> | 2019-01-19 09:24:01 +0100 |
commit | f8b45e2d84a87791aba026d18a098af2cd5e763f (patch) | |
tree | f5368d01e8445b02d3aa67efebf721cf7bae1721 /lib | |
parent | e7f86448c5e95b130dcdcae61344163d3db02779 (diff) | |
parent | bd538d6bb0a9dd72de7e8717bae705245060c2c4 (diff) |
Merge staging-next into staging
Diffstat (limited to 'lib')
-rw-r--r-- | lib/default.nix | 2 | ||||
-rw-r--r-- | lib/meta.nix | 11 |
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/default.nix b/lib/default.nix index 48eb99a7198ac..d400907ebb0cb 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -94,7 +94,7 @@ let callPackageWith callPackagesWith extendDerivation hydraJob makeScope; inherit (meta) addMetaAttrs dontDistribute setName updateName - appendToName mapDerivationAttrset lowPrio lowPrioSet hiPrio + appendToName mapDerivationAttrset setPrio lowPrio lowPrioSet hiPrio hiPrioSet; inherit (sources) pathType pathIsDirectory cleanSourceFilter cleanSource sourceByRegex sourceFilesBySuffices diff --git a/lib/meta.nix b/lib/meta.nix index 199030c103af5..2e83c4247ddfb 100644 --- a/lib/meta.nix +++ b/lib/meta.nix @@ -41,16 +41,18 @@ rec { let x = builtins.parseDrvName name; in "${x.name}-${suffix}-${x.version}"); - /* Apply a function to each derivation and only to derivations in an attrset + /* Apply a function to each derivation and only to derivations in an attrset. */ mapDerivationAttrset = f: set: lib.mapAttrs (name: pkg: if lib.isDerivation pkg then (f pkg) else pkg) set; + /* Set the nix-env priority of the package. + */ + setPrio = priority: addMetaAttrs { inherit priority; }; /* Decrease the nix-env priority of the package, i.e., other versions/variants of the package will be preferred. */ - lowPrio = drv: addMetaAttrs { priority = 10; } drv; - + lowPrio = setPrio 10; /* Apply lowPrio to an attrset with derivations */ @@ -60,8 +62,7 @@ rec { /* Increase the nix-env priority of the package, i.e., this version/variant of the package will be preferred. */ - hiPrio = drv: addMetaAttrs { priority = -10; } drv; - + hiPrio = setPrio (-10); /* Apply hiPrio to an attrset with derivations */ |