2024-06-08 01:20:18 +00:00
|
|
|
# XXX: this is in the bootstrap path;
|
2024-06-08 20:44:23 +00:00
|
|
|
# this means it has to be evaluatable using only builtins,
|
|
|
|
# though i'm free to include optional functionality (e.g. update scripts) so long as i gate it behind availability checks.
|
2024-06-08 01:20:18 +00:00
|
|
|
#
|
|
|
|
# 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
|
2024-06-08 20:44:23 +00:00
|
|
|
#VVV these may or may not be available when called VVV
|
2024-06-08 03:28:47 +00:00
|
|
|
, fetchzip ? builtins.fetchTarball
|
2024-06-08 20:44:23 +00:00
|
|
|
, nix-update-script ? null
|
2024-06-08 01:20:18 +00:00
|
|
|
}:
|
|
|
|
let
|
2024-06-08 03:28:47 +00:00
|
|
|
lock = {
|
|
|
|
master.rev = "716a7056386dcc67eb3b813289499d6329d4befc";
|
|
|
|
master.sha256 = "sha256:1skv9nbnspi3pphk4jzvcj147796m4wqdx8iwdbnl9h4nd3kw6n2";
|
|
|
|
staging.rev = "da9d22446697971278edcd4af92f63221f7d21f6";
|
|
|
|
staging.sha256 = "sha256:0yccyg071zn77i1pfb49dz07difwx5k3w1g0l1vdzlc3xiv9dgmk";
|
|
|
|
staging-next.rev = "5aa86ae5585cd46299ee46682fda8a9b76baf2ae";
|
|
|
|
staging-next.sha256 = "sha256:1dqws7fmdv4l9mk45i88ivzlxzm2b4lbdg9rg4am0z1alsz36dzz";
|
2024-06-08 01:20:18 +00:00
|
|
|
};
|
2024-06-08 20:44:23 +00:00
|
|
|
lock' = lock."${variant}";
|
|
|
|
unpatchedSrc = fetchzip {
|
2024-06-08 03:28:47 +00:00
|
|
|
url = "https://github.com/NixOS/nixpkgs/archive/${lock'.rev}.tar.gz";
|
|
|
|
inherit (lock') sha256;
|
|
|
|
};
|
|
|
|
unpatchedNixpkgs = import unpatchedSrc { inherit localSystem; };
|
2024-06-08 01:20:18 +00:00
|
|
|
|
|
|
|
patchesFor = unpatchedNixpkgs.callPackage ./list.nix { };
|
|
|
|
|
|
|
|
patchedSrc = unpatchedNixpkgs.applyPatches {
|
|
|
|
name = "nixpkgs-patched-uninsane";
|
|
|
|
# version = ...
|
|
|
|
src = unpatchedSrc;
|
|
|
|
patches = patchesFor {
|
|
|
|
inherit variant;
|
|
|
|
date = unpatchedSrc.lastModifiedDate;
|
|
|
|
};
|
2024-06-08 22:49:55 +00:00
|
|
|
# skip applied patches
|
|
|
|
prePatch = ''
|
|
|
|
realpatch=$(command -v patch)
|
|
|
|
patch() {
|
|
|
|
OUT=$($realpatch "$@") || echo "$OUT" | grep "Skipping patch" -q
|
|
|
|
}
|
|
|
|
'';
|
2024-06-08 01:20:18 +00:00
|
|
|
};
|
|
|
|
|
2024-06-08 03:28:47 +00:00
|
|
|
src = if doPatch then patchedSrc else { outPath = unpatchedSrc; };
|
2024-06-08 01:20:18 +00:00
|
|
|
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 {});
|
2024-06-08 22:01:33 +00:00
|
|
|
|
|
|
|
nixpkgs = import "${src}" args;
|
2024-06-08 01:20:18 +00:00
|
|
|
in
|
|
|
|
# N.B.: this is crafted to allow `nixpkgs.FOO` from other nix code
|
|
|
|
# AND `nix-build -A nixpkgs`
|
2024-06-08 22:01:33 +00:00
|
|
|
if src ? overrideAttrs then
|
|
|
|
src.overrideAttrs (base: {
|
|
|
|
# attributes needed for update scripts
|
|
|
|
pname = "nixpkgs";
|
|
|
|
version = "24.05-unstable-2024-06-xx";
|
|
|
|
passthru = (base.passthru or {}) // nixpkgs // {
|
|
|
|
src = unpatchedSrc // {
|
|
|
|
inherit (lock') rev;
|
|
|
|
};
|
|
|
|
updateScript = nix-update-script {
|
|
|
|
extraArgs = [ "--version" "branch" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
})
|
|
|
|
else
|
|
|
|
nixpkgs
|