summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/lib/customisation.nix27
-rw-r--r--pkgs/top-level/all-packages.nix19
2 files changed, 25 insertions, 21 deletions
diff --git a/pkgs/lib/customisation.nix b/pkgs/lib/customisation.nix
index 889ce04547f..76d019a73c2 100644
--- a/pkgs/lib/customisation.nix
+++ b/pkgs/lib/customisation.nix
@@ -1,11 +1,13 @@
-{
+let lib = import ./default.nix; in
+
+rec {
 
 
   /* `overrideDerivation drv f' takes a derivation (i.e., the result
      of a call to the builtin function `derivation') and returns a new
      derivation in which the attributes of the original are overriden
-     according to the function `f'.  This function is called with the
-     original derivation attributes.
+     according to the function `f'.  The function `f' is called with
+     the original derivation attributes.
 
      `overrideDerivation' allows certain "ad-hoc" customisation
      scenarios (e.g. in ~/.nixpkgs/config.nix).  For instance, if you
@@ -37,4 +39,23 @@
       };
 
 
+  # usage: (you can use override multiple times)
+  # let d = makeOverridable stdenv.mkDerivation { name = ..; buildInputs; }
+  #     noBuildInputs = d.override { buildInputs = []; }
+  #     additionalBuildInputs = d.override ( args : args // { buildInputs = args.buildInputs ++ [ additional ]; } )
+  makeOverridable = f: origArgs: f origArgs //
+    { override = newArgs:
+        makeOverridable f (origArgs // (if builtins.isFunction newArgs then newArgs origArgs else newArgs));
+      deepOverride = newArgs:
+        makeOverridable f ((lib.mapAttrs (deepOverride newArgs) origArgs) // newArgs);
+      origArgs = origArgs;
+    };
+
+
+  deepOverride = 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/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 79f296b92ab..8f66c381677 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -125,7 +125,7 @@ let
 
   inherit lib config getConfig;
 
-  inherit (lib) lowPrio appendToName;
+  inherit (lib) lowPrio appendToName makeOverridable;
 
   # Applying this to an attribute set will cause nix-env to look
   # inside the set for derivations.
@@ -157,23 +157,6 @@ let
 
   stringsWithDeps = lib.stringsWithDeps;
 
-  deepOverride = 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;
-    
-  # usage: (you can use override multiple times)
-  # let d = makeOverridable stdenv.mkDerivation { name = ..; buildInputs; }
-  #     noBuildInputs = d.override { buildInputs = []; }
-  #     additionalBuildInputs = d.override ( args : args // { buildInputs = args.buildInputs ++ [ additional ]; } )
-  makeOverridable = f: origArgs: f origArgs //
-    { override = newArgs:
-        makeOverridable f (origArgs // (if builtins.isFunction newArgs then newArgs origArgs else newArgs));
-      deepOverride = newArgs:
-        makeOverridable f ((lib.mapAttrs (deepOverride newArgs) origArgs) // newArgs);
-      origArgs = origArgs;
-    };
-
 
   ### STANDARD ENVIRONMENT