nixpkgs-bootstrap.mkNixpkgs: remove the overrideAttrs call, and inline its functionality into applyPatches

This commit is contained in:
2025-05-09 06:48:11 +00:00
parent bac24e6ceb
commit e99e2f5a6e

View File

@@ -101,9 +101,15 @@ let
fetchpatch2' = if fetchpatch2 != null then fetchpatch2 else unpatchedNixpkgs.fetchpatch2; fetchpatch2' = if fetchpatch2 != null then fetchpatch2 else unpatchedNixpkgs.fetchpatch2;
patchedSrc = applyPatches' { patchedSrc = applyPatches' {
src = src';
name = "nixpkgs-patched-uninsane"; name = "nixpkgs-patched-uninsane";
inherit version; inherit version;
src = {
# required by unstableGitUpdater
gitRepoUrl = "https://github.com/NixOS/nixpkgs.git";
inherit rev;
} // src';
patches = import ./patches.nix { fetchpatch2 = fetchpatch2'; }; patches = import ./patches.nix { fetchpatch2 = fetchpatch2'; };
# skip applied patches # skip applied patches
prePatch = '' prePatch = ''
@@ -112,34 +118,10 @@ let
OUT=$($realpatch "$@") || echo "$OUT" | grep "Skipping patch" -q OUT=$($realpatch "$@") || echo "$OUT" | grep "Skipping patch" -q
} }
''; '';
};
nixpkgsArgs = commonNixpkgsArgs // { passthru = {
config = {
allowUnfree = true; # NIXPKGS_ALLOW_UNFREE=1
allowBroken = true; # NIXPKGS_ALLOW_BROKEN=1
};
} // (if (system != localSystem) then {
# XXX(2023/12/11): cache.nixos.org uses `system = ...` instead of `hostPlatform.system`, and that choice impacts the closure of every package.
# so avoid specifying hostPlatform.system on non-cross builds, so i can use upstream caches.
crossSystem = system;
} else {});
nixpkgs = import patchedSrc nixpkgsArgs;
in
patchedSrc.overrideAttrs (base: {
# attributes needed for update scripts.
# TODO: should be possible to pass these straight through `applyPatches` instead of using `overrideAttrs`.
inherit version;
pname = "nixpkgs";
passthru = (base.passthru or {}) // {
pkgs = nixpkgs; pkgs = nixpkgs;
src = {
# required by unstableGitUpdater
gitRepoUrl = "https://github.com/NixOS/nixpkgs.git";
inherit rev;
} // src';
# required so that unstableGitUpdater can know in which file the `rev` variable can be updated in. # required so that unstableGitUpdater can know in which file the `rev` variable can be updated in.
meta.position = let meta.position = let
position = builtins.unsafeGetAttrPos "rev" args; position = builtins.unsafeGetAttrPos "rev" args;
@@ -157,7 +139,21 @@ let
inherit branch; inherit branch;
}; };
}; };
}) };
nixpkgsArgs = commonNixpkgsArgs // {
config = {
allowUnfree = true; # NIXPKGS_ALLOW_UNFREE=1
allowBroken = true; # NIXPKGS_ALLOW_BROKEN=1
};
} // (if (system != localSystem) then {
# XXX(2023/12/11): cache.nixos.org uses `system = ...` instead of `hostPlatform.system`, and that choice impacts the closure of every package.
# so avoid specifying hostPlatform.system on non-cross builds, so i can use upstream caches.
crossSystem = system;
} else {});
nixpkgs = import patchedSrc nixpkgsArgs;
in
patchedSrc
; ;
in in
mkNixpkgs mkNixpkgs