summary refs log tree commit diff
path: root/pkgs/lib
diff options
context:
space:
mode:
authorMichael Raskin <7c6f434c@mail.ru>2010-07-08 13:25:52 +0000
committerMichael Raskin <7c6f434c@mail.ru>2010-07-08 13:25:52 +0000
commitccc497f80d4bc74f392beca717ea4781a3a60ddd (patch)
treeee308e93a0932a4cf46d29ac8d9bbcb68beedb9a /pkgs/lib
parent3c824666fd86301494f2a6db3ebf1b2e1277541a (diff)
downloadnixlib-ccc497f80d4bc74f392beca717ea4781a3a60ddd.tar
nixlib-ccc497f80d4bc74f392beca717ea4781a3a60ddd.tar.gz
nixlib-ccc497f80d4bc74f392beca717ea4781a3a60ddd.tar.bz2
nixlib-ccc497f80d4bc74f392beca717ea4781a3a60ddd.tar.lz
nixlib-ccc497f80d4bc74f392beca717ea4781a3a60ddd.tar.xz
nixlib-ccc497f80d4bc74f392beca717ea4781a3a60ddd.tar.zst
nixlib-ccc497f80d4bc74f392beca717ea4781a3a60ddd.zip
Make WebKit use libsoup 2.31.2 via deepOverride. Edit a few packages that were overridable but did not allow extra arguments. Remove a catch with deepOverride that pkgs.lib had this attribute in a different sense.
svn path=/nixpkgs/trunk/; revision=22529
Diffstat (limited to 'pkgs/lib')
-rw-r--r--pkgs/lib/customisation.nix4
-rw-r--r--pkgs/lib/misc.nix99
2 files changed, 57 insertions, 46 deletions
diff --git a/pkgs/lib/customisation.nix b/pkgs/lib/customisation.nix
index 334c80366275..177856e4d0ef 100644
--- a/pkgs/lib/customisation.nix
+++ b/pkgs/lib/customisation.nix
@@ -53,12 +53,12 @@ rec {
     { override = newArgs:
         makeOverridable f (origArgs // (if builtins.isFunction newArgs then newArgs origArgs else newArgs));
       deepOverride = newArgs:
-        makeOverridable f ((lib.mapAttrs (deepOverride newArgs) origArgs) // newArgs);
+        makeOverridable f ((lib.mapAttrs (deepOverrider newArgs) origArgs) // newArgs);
       origArgs = origArgs;
     };
 
 
-  deepOverride = newArgs: name: x: if builtins.isAttrs x then (
+  deepOverrider = newArgs: name: x: if builtins.isAttrs x then (
     if x ? deepOverride then (x.deepOverride newArgs) else
     if x ? override then (x.override newArgs) else
     x) else x;
diff --git a/pkgs/lib/misc.nix b/pkgs/lib/misc.nix
index f3eb7e8bf8fc..321b641372d5 100644
--- a/pkgs/lib/misc.nix
+++ b/pkgs/lib/misc.nix
@@ -22,9 +22,20 @@ rec {
   sumTwoArgs = f: x: y: 
     f (defaultMerge x y);
   foldArgs = merger: f: init: x: 
-    let arg=(merger init (defaultMergeArg init x)); in  
+    let arg=(merger init (defaultMergeArg init x));
       # now add the function with composed args already applied to the final attrs
-    setAttrMerge "passthru" {} (f arg) ( x : x // { function = foldArgs merger f arg; } );
+        base = (setAttrMerge "passthru" {} (f arg) 
+                        ( z : z // rec { 
+                          function = foldArgs merger f arg; 
+			  args = (lib.attrByPath ["passthru" "args"] {} z) // x;
+                          } ));
+	withStdOverrides = base // {
+	   override = base.passthru.function;
+	   deepOverride = a : (base.passthru.function ((lib.mapAttrs (lib.deepOverrider a) base.passthru.args) // a));
+	   } ;
+        in
+	withStdOverrides;
+    
 
   # predecessors: proposed replacement for applyAndFun (which has a bug cause it merges twice)
   # the naming "overridableDelayableArgs" tries to express that you can
@@ -117,22 +128,22 @@ rec {
     
   # Return true only if there is an attribute and it is true.
   checkFlag = attrSet: name:
-	if (name == "true") then true else
-	if (name == "false") then false else
-	if (elem name (attrByPath ["flags"] [] attrSet)) then true else
-	attrByPath [name] false attrSet ;
+        if (name == "true") then true else
+        if (name == "false") then false else
+        if (elem name (attrByPath ["flags"] [] attrSet)) then true else
+        attrByPath [name] false attrSet ;
 
 
   # Input : attrSet, [ [name default] ... ], name
   # Output : its value or default.
   getValue = attrSet: argList: name:
   ( attrByPath [name] (if checkFlag attrSet name then true else
-	if argList == [] then null else
-	let x = builtins.head argList; in
-		if (head x) == name then 
-			(head (tail x))
-		else (getValue attrSet 
-			(tail argList) name)) attrSet );
+        if argList == [] then null else
+        let x = builtins.head argList; in
+                if (head x) == name then 
+                        (head (tail x))
+                else (getValue attrSet 
+                        (tail argList) name)) attrSet );
 
                         
   # Input : attrSet, [[name default] ...], [ [flagname reqs..] ... ]
@@ -141,46 +152,46 @@ rec {
   (
     fold lib.and true 
       (map (x: let name = (head x) ; in
-	
-	((checkFlag attrSet name) -> 
-	(fold lib.and true
-	(map (y: let val=(getValue attrSet argList y); in
-		(val!=null) && (val!=false)) 
-	(tail x))))) condList)) ;
-	
+        
+        ((checkFlag attrSet name) -> 
+        (fold lib.and true
+        (map (y: let val=(getValue attrSet argList y); in
+                (val!=null) && (val!=false)) 
+        (tail x))))) condList)) ;
+        
 
   # !!! This function has O(n^2) performance, so you probably don't want to use it!
   uniqList = {inputList, outputList ? []}:
-	if (inputList == []) then outputList else
-	let x=head inputList; 
-	newOutputList = outputList ++
-	 (if elem x outputList then [] else [x]);
-	in uniqList {outputList=newOutputList; 
-		inputList = (tail inputList);};
+        if (inputList == []) then outputList else
+        let x=head inputList; 
+        newOutputList = outputList ++
+         (if elem x outputList then [] else [x]);
+        in uniqList {outputList=newOutputList; 
+                inputList = (tail inputList);};
 
   uniqListExt = {inputList, outputList ? [],
     getter ? (x : x), compare ? (x: y: x==y)}:
-	if (inputList == []) then outputList else
-	let x=head inputList; 
-	isX = y: (compare (getter y) (getter x));
-	newOutputList = outputList ++
-	 (if any isX outputList then [] else [x]);
-	in uniqListExt {outputList=newOutputList; 
-		inputList = (tail inputList);
-		inherit getter compare;
-		};
+        if (inputList == []) then outputList else
+        let x=head inputList; 
+        isX = y: (compare (getter y) (getter x));
+        newOutputList = outputList ++
+         (if any isX outputList then [] else [x]);
+        in uniqListExt {outputList=newOutputList; 
+                inputList = (tail inputList);
+                inherit getter compare;
+                };
 
 
                 
   condConcat = name: list: checker:
-	if list == [] then name else
-	if checker (head list) then 
-		condConcat 
-			(name + (head (tail list))) 
-			(tail (tail list)) 
-			checker
-	else condConcat
-		name (tail (tail list)) checker;
+        if list == [] then name else
+        if checker (head list) then 
+                condConcat 
+                        (name + (head (tail list))) 
+                        (tail (tail list)) 
+                        checker
+        else condConcat
+                name (tail (tail list)) checker;
 
   lazyGenericClosure = {startSet, operator}:
     let
@@ -201,7 +212,7 @@ rec {
     else lazyGenericClosure;
 
   innerModifySumArgs = f: x: a: b: if b == null then (f a b) // x else 
-	innerModifySumArgs f x (a // b);
+        innerModifySumArgs f x (a // b);
   modifySumArgs = f: x: innerModifySumArgs f x {};
 
 
@@ -210,7 +221,7 @@ rec {
       (ready ++ [(head list)])
       ((tail list) 
          ++ (maybeAttrNullable "propagatedBuildInputs" [] (head list))
-	 ++ (maybeAttrNullable "propagatedBuildNativeInputs" [] (head list)));
+         ++ (maybeAttrNullable "propagatedBuildNativeInputs" [] (head list)));
 
   closePropagation = list: (uniqList {inputList = (innerClosePropagation [] list);});