nixpkgs-bootstrap: hoist config to callArgs level, to simplify the call site
This commit is contained in:
@@ -8,11 +8,10 @@
|
|||||||
localSystem ? builtins.currentSystem,
|
localSystem ? builtins.currentSystem,
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
mkNixpkgs = import ./pkgs/by-name/nixpkgs-bootstrap/mkNixpkgs.nix {};
|
mkPkgs = branch: config: let
|
||||||
mkPkgs = branch: config: (
|
mkNixpkgs = import ./pkgs/by-name/nixpkgs-bootstrap/mkNixpkgs.nix config;
|
||||||
import ./pkgs/by-name/nixpkgs-bootstrap/${branch}.nix {
|
in (
|
||||||
mkNixpkgs = args: mkNixpkgs (config // args);
|
import ./pkgs/by-name/nixpkgs-bootstrap/${branch}.nix { inherit mkNixpkgs; }
|
||||||
}
|
|
||||||
).pkgs.extend (import ./overlays/all.nix);
|
).pkgs.extend (import ./overlays/all.nix);
|
||||||
pkgs = mkPkgs "master" { inherit localSystem; };
|
pkgs = mkPkgs "master" { inherit localSystem; };
|
||||||
inherit (pkgs) lib;
|
inherit (pkgs) lib;
|
||||||
|
@@ -42,6 +42,9 @@
|
|||||||
fetchzip ? null,
|
fetchzip ? null,
|
||||||
stdenv ? null,
|
stdenv ? null,
|
||||||
unstableGitUpdater ? 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
|
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.
|
# 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 ? "",
|
rev ? "",
|
||||||
sha256 ? "",
|
sha256 ? "",
|
||||||
version ? "",
|
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
|
}@args: let
|
||||||
url = "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz";
|
url = "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz";
|
||||||
pname = "nixpkgs-${branch}";
|
pname = "nixpkgs-${branch}";
|
||||||
@@ -126,47 +126,38 @@ let
|
|||||||
} else {});
|
} else {});
|
||||||
nixpkgs = import patchedSrc nixpkgsArgs;
|
nixpkgs = import patchedSrc nixpkgsArgs;
|
||||||
in
|
in
|
||||||
if rev == "" && sha256 == "" && version == "" then
|
patchedSrc.overrideAttrs (base: {
|
||||||
# allow `impure.nix` to invoke this with only `branch`, and we figure out the details for it.
|
# attributes needed for update scripts.
|
||||||
# TODO: remove this code path.
|
# TODO: should be possible to pass these straight through `applyPatches` instead of using `overrideAttrs`.
|
||||||
import ./${branch}.nix {
|
inherit version;
|
||||||
mkNixpkgs = args': mkNixpkgs ({
|
pname = "nixpkgs";
|
||||||
inherit localSystem system;
|
passthru = (base.passthru or {}) // {
|
||||||
} // args');
|
pkgs = nixpkgs;
|
||||||
}
|
|
||||||
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;
|
|
||||||
|
|
||||||
src = {
|
src = {
|
||||||
# required by unstableGitUpdater
|
# required by unstableGitUpdater
|
||||||
gitRepoUrl = "https://github.com/NixOS/nixpkgs.git";
|
gitRepoUrl = "https://github.com/NixOS/nixpkgs.git";
|
||||||
inherit rev;
|
inherit rev;
|
||||||
} // src';
|
} // 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;
|
||||||
in
|
in
|
||||||
"${position.file}:${toString position.line}";
|
"${position.file}:${toString position.line}";
|
||||||
|
|
||||||
# while we could *technically* use `nixpkgs.<...>` updateScript
|
# while we could *technically* use `nixpkgs.<...>` updateScript
|
||||||
# that can force maaany rebuilds on staging/staging-next.
|
# that can force maaany rebuilds on staging/staging-next.
|
||||||
# updateScript = nix-update-script {
|
# updateScript = nix-update-script {
|
||||||
# extraArgs = [ "--version=branch=${branch}" ];
|
# extraArgs = [ "--version=branch=${branch}" ];
|
||||||
# };
|
# };
|
||||||
updateScript = unstableGitUpdater {
|
updateScript = unstableGitUpdater {
|
||||||
# else the update script tries to walk 10000's of commits to find a tag
|
# else the update script tries to walk 10000's of commits to find a tag
|
||||||
hardcodeZeroVersion = true;
|
hardcodeZeroVersion = true;
|
||||||
inherit branch;
|
inherit branch;
|
||||||
};
|
|
||||||
};
|
};
|
||||||
})
|
};
|
||||||
|
})
|
||||||
;
|
;
|
||||||
in
|
in
|
||||||
mkNixpkgs
|
mkNixpkgs
|
||||||
|
Reference in New Issue
Block a user