From eb8e943493164009f34ba4c0a824533ce755f1dd Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Tue, 31 Aug 2021 09:15:44 +0200 Subject: [PATCH] Fix interaction between appendOverlays and otherPackageSets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The comment a dirty hack that should be removed has led me to believe that nixpkgsFun isn't the right solution, but bypassing it is worse, because it creates a second, inner overriding mechanism that doesn't pass its changes to the old, outer overriding mechanism. Before this change: nix-repl> ((import {}).appendOverlays([(f: s: { foobarbaz = "ok"; })])).foobarbaz "ok" nix-repl> ((import {}).appendOverlays([(f: s: { foobarbaz = "ok"; })])).pkgsCross.aarch64-multiplatform.foobarbaz error: attribute 'foobarbaz' missing at «string»:1:1: 1| ((import {}).appendOverlays([(f: s: { foobarbaz = "ok"; })])).pkgsCross.aarch64-multiplatform.foobarbaz | ^ 2| After this change: nix-repl> ((import ./. {}).appendOverlays([(f: s: { foobarbaz = "ok"; })])).pkgsCross.aarch64-multiplatform.foobarbaz "ok" Thanks to samueldr for discovering this problem. --- pkgs/top-level/stage.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/top-level/stage.nix b/pkgs/top-level/stage.nix index b01ef584d206e..84c4d8fc40591 100644 --- a/pkgs/top-level/stage.nix +++ b/pkgs/top-level/stage.nix @@ -15,7 +15,7 @@ # Utility functions, could just import but passing in for efficiency lib -, # Use to reevaluate Nixpkgs; a dirty hack that should be removed +, # Use to reevaluate Nixpkgs nixpkgsFun ## Other parameters @@ -218,7 +218,7 @@ let appendOverlays = extraOverlays: if extraOverlays == [] then self - else import ./stage.nix (args // { overlays = args.overlays ++ extraOverlays; }); + else nixpkgsFun { overlays = args.overlays ++ extraOverlays; }; # NOTE: each call to extend causes a full nixpkgs rebuild, adding ~130MB # of allocations. DO NOT USE THIS IN NIXPKGS.