nixpkgs-bootstrap: rework "mkNixpkgs" such that "nixpkgs-bootstrap.$channel.updateScript" can be evaluated *without* importing the underlying nixpkgs

this makes it possible to update out of a nixpkgs staging rev whose toplevel attrset doesn't eval
This commit is contained in:
2025-03-27 03:32:01 +00:00
parent 7169193cc4
commit 54b2151a00
3 changed files with 4 additions and 8 deletions

View File

@@ -10,7 +10,7 @@
let let
mkNixpkgs = import ./pkgs/by-name/nixpkgs-bootstrap/mkNixpkgs.nix {}; mkNixpkgs = import ./pkgs/by-name/nixpkgs-bootstrap/mkNixpkgs.nix {};
mkPkgs = branch: args: ( mkPkgs = branch: args: (
mkNixpkgs (args // { inherit branch; }) (mkNixpkgs (args // { inherit branch; })).pkgs
).extend (import ./overlays/all.nix); ).extend (import ./overlays/all.nix);
pkgs = mkPkgs "master" { inherit localSystem; }; pkgs = mkPkgs "master" { inherit localSystem; };
inherit (pkgs) lib; inherit (pkgs) lib;

View File

@@ -91,17 +91,16 @@ let
} // args'); } // args');
} }
else else
# N.B.: this is crafted to allow `nixpkgs.FOO` from other nix code
# AND `nix-build -A nixpkgs`
patchedSrc.overrideAttrs (base: { patchedSrc.overrideAttrs (base: {
# attributes needed for update scripts # attributes needed for update scripts
inherit version; inherit version;
pname = "nixpkgs"; pname = "nixpkgs";
passthru = (base.passthru or {}) // nixpkgs // { passthru = (base.passthru or {}) // {
# override is used to configure hostPlatform higher up. # override is used to configure hostPlatform higher up.
override = overrideArgs: mkNixpkgs (args // overrideArgs); override = overrideArgs: mkNixpkgs (args // overrideArgs);
# N.B.: src has to be specified in passthru, not the outer scope, so as to take precedence over the nixpkgs `src` package pkgs = nixpkgs;
src = { src = {
# required by unstableGitUpdater # required by unstableGitUpdater
gitRepoUrl = "https://github.com/NixOS/nixpkgs.git"; gitRepoUrl = "https://github.com/NixOS/nixpkgs.git";

View File

@@ -54,9 +54,6 @@ let
}); });
### aliases ### aliases
# nixpkgs = nixpkgs-bootstrap.master;
# nixpkgs-staging = nixpkgs-bootstrap.staging;
# nixpkgs-next = nixpkgs-bootstrap.staging-next;
inherit (trivial-builders) inherit (trivial-builders)
copyIntoOwnPackage copyIntoOwnPackage
deepLinkIntoOwnPackage deepLinkIntoOwnPackage