summary refs log tree commit diff
path: root/pkgs/top-level/stage.nix
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2018-09-27 18:21:26 +0200
committerRobert Hensing <robert@roberthensing.nl>2018-10-18 10:48:43 +0200
commitba8b54fa4a91cd94e8c42095d4f82d4a93cd01d1 (patch)
tree2f1c8b4a392266498c93d1cca1201b0bb86a870e /pkgs/top-level/stage.nix
parent3026f55a0c0461e94cbbcc431cf2384efbf4bcfa (diff)
downloadnixpkgs-ba8b54fa4a91cd94e8c42095d4f82d4a93cd01d1.tar
nixpkgs-ba8b54fa4a91cd94e8c42095d4f82d4a93cd01d1.tar.gz
nixpkgs-ba8b54fa4a91cd94e8c42095d4f82d4a93cd01d1.tar.bz2
nixpkgs-ba8b54fa4a91cd94e8c42095d4f82d4a93cd01d1.tar.lz
nixpkgs-ba8b54fa4a91cd94e8c42095d4f82d4a93cd01d1.tar.xz
nixpkgs-ba8b54fa4a91cd94e8c42095d4f82d4a93cd01d1.tar.zst
nixpkgs-ba8b54fa4a91cd94e8c42095d4f82d4a93cd01d1.zip
Add Nixpkgs functions for adding overlays ad-hoc
This is something that I have found useful in tests. In practice
I recommend that people call Nixpkgs once for performance and
simplicity. The inline documentation mentions this too.
Diffstat (limited to 'pkgs/top-level/stage.nix')
-rw-r--r--pkgs/top-level/stage.nix15
1 files changed, 14 insertions, 1 deletions
diff --git a/pkgs/top-level/stage.nix b/pkgs/top-level/stage.nix
index d0fb885dc74..37724a870a3 100644
--- a/pkgs/top-level/stage.nix
+++ b/pkgs/top-level/stage.nix
@@ -56,7 +56,7 @@
 , # A list of overlays (Additional `self: super: { .. }` customization
   # functions) to be fixed together in the produced package set
   overlays
-}:
+} @args:
 
 let
   stdenvAdapters = self: super:
@@ -159,6 +159,19 @@ let
         };
       };
     };
+
+    # Extend the package set with zero or more overlays. This preserves
+    # preexisting overlays. Prefer to initialize with the right overlays
+    # in one go when calling Nixpkgs, for performance and simplicity.
+    appendOverlays = extraOverlays:
+      import ./stage.nix (args // { overlays = args.overlays ++ extraOverlays; });
+
+    # Extend the package set with a single overlay. This preserves
+    # preexisting overlays. Prefer to initialize with the right overlays
+    # in one go when calling Nixpkgs, for performance and simplicity.
+    # Prefer appendOverlays if used repeatedly.
+    extend = f: self.appendOverlays [f];
+
   };
 
   # The complete chain of package set builders, applied from top to bottom.