diff options
author | Evgeny Egorochkin <phreedom@yandex.ru> | 2013-12-26 04:22:29 +0200 |
---|---|---|
committer | Evgeny Egorochkin <phreedom@yandex.ru> | 2013-12-26 04:22:29 +0200 |
commit | bdfcda81e763f2fe0b3285f18048428e6e95662a (patch) | |
tree | f49561e32770143da0acee6b349f3e57cb333efe /lib/meta.nix | |
parent | 7a988c62af89fc220d91bcb1062f593b82c326d6 (diff) |
add lowPrioSet and hiPrioSet functions to enable changing of priorities of attrsets with packages such as kde.
Diffstat (limited to 'lib/meta.nix')
-rw-r--r-- | lib/meta.nix | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/meta.nix b/lib/meta.nix index a5afce9e0cb1..74e9cfb411c4 100644 --- a/lib/meta.nix +++ b/lib/meta.nix @@ -1,6 +1,9 @@ /* Some functions for manipulating meta attributes, as well as the name attribute. */ +let lib = import ./default.nix; +in + rec { @@ -35,14 +38,30 @@ rec { appendToName = suffix: updateName (name: "${name}-${suffix}"); + /* 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; + + /* 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; + + /* Apply lowPrio to an attrset with derivations + */ + lowPrioSet = set: mapDerivationAttrset lowPrio set; + + /* 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; + + + /* Apply hiPrio to an attrset with derivations + */ + hiPrioSet = set: mapDerivationAttrset hiPrio set; } |