summary refs log tree commit diff
path: root/lib/meta.nix
diff options
context:
space:
mode:
authorVladimír Čunát <vcunat@gmail.com>2013-12-28 23:28:30 +0100
committerVladimír Čunát <vcunat@gmail.com>2013-12-29 10:01:22 +0100
commite740b565cf01082be314dff8833c4a65a834bcff (patch)
tree59e8ce4fd4ecf004581e1f1eed533970fd6eba69 /lib/meta.nix
parentcb639302df235bc1a9a3f1c14901c021813ee6b5 (diff)
parent9f735bdf5784ef1d93122036d5add9ad35c19a35 (diff)
downloadnixpkgs-e740b565cf01082be314dff8833c4a65a834bcff.tar
nixpkgs-e740b565cf01082be314dff8833c4a65a834bcff.tar.gz
nixpkgs-e740b565cf01082be314dff8833c4a65a834bcff.tar.bz2
nixpkgs-e740b565cf01082be314dff8833c4a65a834bcff.tar.lz
nixpkgs-e740b565cf01082be314dff8833c4a65a834bcff.tar.xz
nixpkgs-e740b565cf01082be314dff8833c4a65a834bcff.tar.zst
nixpkgs-e740b565cf01082be314dff8833c4a65a834bcff.zip
Merge master into stdenv-updates
Conflicts (easy):
	pkgs/development/compilers/llvm/default.nix
	pkgs/development/compilers/openjdk/default.nix
	pkgs/development/libraries/icu/default.nix
	pkgs/development/libraries/libssh/default.nix
	pkgs/development/libraries/libxslt/default.nix
	pkgs/development/tools/parsing/bison/3.x.nix
Diffstat (limited to 'lib/meta.nix')
-rw-r--r--lib/meta.nix19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/meta.nix b/lib/meta.nix
index a5afce9e0cb..74e9cfb411c 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;
   
 }