From ba8b54fa4a91cd94e8c42095d4f82d4a93cd01d1 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Thu, 27 Sep 2018 18:21:26 +0200 Subject: 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. --- pkgs/top-level/stage.nix | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pkgs/top-level/stage.nix b/pkgs/top-level/stage.nix index d0fb885dc747..37724a870a30 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. -- cgit 1.4.1