64 lines
2.3 KiB
Nix
64 lines
2.3 KiB
Nix
|
# XXX: this is in the bootstrap path;
|
||
|
# i'm pretty much restricted to using just `builtin`s here.
|
||
|
#
|
||
|
# branch workflow:
|
||
|
# - daily:
|
||
|
# - nixos-unstable cut from master after enough packages have been built in caches.
|
||
|
# - every 6 hours:
|
||
|
# - master auto-merged into staging and staging-next
|
||
|
# - staging-next auto-merged into staging.
|
||
|
# - manually, approximately once per month:
|
||
|
# - staging-next is cut from staging.
|
||
|
# - staging-next merged into master.
|
||
|
#
|
||
|
# which branch to source from?
|
||
|
# - nixos-unstable: for everyday development; it provides good caching
|
||
|
# - master: temporarily if i'm otherwise cherry-picking lots of already-applied patches
|
||
|
# - staging-next: if testing stuff that's been PR'd into staging, i.e. base library updates.
|
||
|
# - staging: maybe if no staging-next -> master PR has been cut yet?
|
||
|
{ variant ? "master"
|
||
|
, doPatch ? true
|
||
|
, localSystem ? builtins.currentSystem #< not available in pure mode
|
||
|
, system ? localSystem
|
||
|
}:
|
||
|
let
|
||
|
unpatchedSrc = builtins.fetchGit {
|
||
|
url = "https://github.com/NixOS/nixpkgs.git";
|
||
|
ref = variant;
|
||
|
rev = {
|
||
|
master = "716a7056386dcc67eb3b813289499d6329d4befc";
|
||
|
staging = "da9d22446697971278edcd4af92f63221f7d21f6";
|
||
|
staging-next = "5aa86ae5585cd46299ee46682fda8a9b76baf2ae";
|
||
|
}."${variant}";
|
||
|
};
|
||
|
unpatchedNixpkgs = import "${unpatchedSrc}" { inherit localSystem; };
|
||
|
|
||
|
patchesFor = unpatchedNixpkgs.callPackage ./list.nix { };
|
||
|
|
||
|
patchedSrc = unpatchedNixpkgs.applyPatches {
|
||
|
name = "nixpkgs-patched-uninsane";
|
||
|
# version = ...
|
||
|
src = unpatchedSrc;
|
||
|
patches = patchesFor {
|
||
|
inherit variant;
|
||
|
date = unpatchedSrc.lastModifiedDate;
|
||
|
};
|
||
|
};
|
||
|
|
||
|
src = if doPatch then patchedSrc else unpatchedSrc;
|
||
|
args = {
|
||
|
inherit localSystem;
|
||
|
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 {});
|
||
|
in
|
||
|
# N.B.: this is crafted to allow `nixpkgs.FOO` from other nix code
|
||
|
# AND `nix-build -A nixpkgs`
|
||
|
src // (import "${src}" args)
|