nixpkgs-bootstrap: hoist config to callArgs level, to simplify the call site
This commit is contained in:
@@ -8,11 +8,10 @@
|
||||
localSystem ? builtins.currentSystem,
|
||||
}:
|
||||
let
|
||||
mkNixpkgs = import ./pkgs/by-name/nixpkgs-bootstrap/mkNixpkgs.nix {};
|
||||
mkPkgs = branch: config: (
|
||||
import ./pkgs/by-name/nixpkgs-bootstrap/${branch}.nix {
|
||||
mkNixpkgs = args: mkNixpkgs (config // args);
|
||||
}
|
||||
mkPkgs = branch: config: let
|
||||
mkNixpkgs = import ./pkgs/by-name/nixpkgs-bootstrap/mkNixpkgs.nix config;
|
||||
in (
|
||||
import ./pkgs/by-name/nixpkgs-bootstrap/${branch}.nix { inherit mkNixpkgs; }
|
||||
).pkgs.extend (import ./overlays/all.nix);
|
||||
pkgs = mkPkgs "master" { inherit localSystem; };
|
||||
inherit (pkgs) lib;
|
||||
|
@@ -42,6 +42,9 @@
|
||||
fetchzip ? null,
|
||||
stdenv ? null,
|
||||
unstableGitUpdater ? null,
|
||||
#VVV config
|
||||
localSystem ? if stdenv != null then stdenv.buildPlatform.system else builtins.currentSystem, #< not available in pure mode
|
||||
system ? if stdenv != null then stdenv.hostPlatform.system else localSystem,
|
||||
}:
|
||||
let
|
||||
# nixpkgs' update-source-version (updateScript) calculates the new hash for a `src` by specifying this hardcoded bogus hash and then attempting to realize it.
|
||||
@@ -62,9 +65,6 @@ let
|
||||
rev ? "",
|
||||
sha256 ? "",
|
||||
version ? "",
|
||||
#VVV config
|
||||
localSystem ? if stdenv != null then stdenv.buildPlatform.system else builtins.currentSystem, #< not available in pure mode
|
||||
system ? if stdenv != null then stdenv.hostPlatform.system else localSystem,
|
||||
}@args: let
|
||||
url = "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz";
|
||||
pname = "nixpkgs-${branch}";
|
||||
@@ -126,47 +126,38 @@ let
|
||||
} else {});
|
||||
nixpkgs = import patchedSrc nixpkgsArgs;
|
||||
in
|
||||
if rev == "" && sha256 == "" && version == "" then
|
||||
# allow `impure.nix` to invoke this with only `branch`, and we figure out the details for it.
|
||||
# TODO: remove this code path.
|
||||
import ./${branch}.nix {
|
||||
mkNixpkgs = args': mkNixpkgs ({
|
||||
inherit localSystem system;
|
||||
} // args');
|
||||
}
|
||||
else
|
||||
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;
|
||||
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;
|
||||
|
||||
src = {
|
||||
# required by unstableGitUpdater
|
||||
gitRepoUrl = "https://github.com/NixOS/nixpkgs.git";
|
||||
inherit rev;
|
||||
} // src';
|
||||
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.
|
||||
meta.position = let
|
||||
position = builtins.unsafeGetAttrPos "rev" args;
|
||||
in
|
||||
"${position.file}:${toString position.line}";
|
||||
# required so that unstableGitUpdater can know in which file the `rev` variable can be updated in.
|
||||
meta.position = let
|
||||
position = builtins.unsafeGetAttrPos "rev" args;
|
||||
in
|
||||
"${position.file}:${toString position.line}";
|
||||
|
||||
# while we could *technically* use `nixpkgs.<...>` updateScript
|
||||
# that can force maaany rebuilds on staging/staging-next.
|
||||
# updateScript = nix-update-script {
|
||||
# extraArgs = [ "--version=branch=${branch}" ];
|
||||
# };
|
||||
updateScript = unstableGitUpdater {
|
||||
# else the update script tries to walk 10000's of commits to find a tag
|
||||
hardcodeZeroVersion = true;
|
||||
inherit branch;
|
||||
};
|
||||
# while we could *technically* use `nixpkgs.<...>` updateScript
|
||||
# that can force maaany rebuilds on staging/staging-next.
|
||||
# updateScript = nix-update-script {
|
||||
# extraArgs = [ "--version=branch=${branch}" ];
|
||||
# };
|
||||
updateScript = unstableGitUpdater {
|
||||
# else the update script tries to walk 10000's of commits to find a tag
|
||||
hardcodeZeroVersion = true;
|
||||
inherit branch;
|
||||
};
|
||||
})
|
||||
};
|
||||
})
|
||||
;
|
||||
in
|
||||
mkNixpkgs
|
||||
|
Reference in New Issue
Block a user