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
mkNixpkgs = import ./pkgs/by-name/nixpkgs-bootstrap/mkNixpkgs.nix {};
mkPkgs = branch: args: (
mkNixpkgs (args // { inherit branch; })
(mkNixpkgs (args // { inherit branch; })).pkgs
).extend (import ./overlays/all.nix);
pkgs = mkPkgs "master" { inherit localSystem; };
inherit (pkgs) lib;

View File

@@ -91,17 +91,16 @@ let
} // args');
}
else
# N.B.: this is crafted to allow `nixpkgs.FOO` from other nix code
# AND `nix-build -A nixpkgs`
patchedSrc.overrideAttrs (base: {
# attributes needed for update scripts
inherit version;
pname = "nixpkgs";
passthru = (base.passthru or {}) // nixpkgs // {
passthru = (base.passthru or {}) // {
# override is used to configure hostPlatform higher up.
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 = {
# required by unstableGitUpdater
gitRepoUrl = "https://github.com/NixOS/nixpkgs.git";

View File

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