nixpkgs-bootstrap: make the updater atomic, thereby allowing update of nixpkgs-bootstrap.master
in parallel with anything else
This commit is contained in:
@@ -40,13 +40,14 @@
|
|||||||
applyPatches ? null,
|
applyPatches ? null,
|
||||||
fetchpatch2 ? null,
|
fetchpatch2 ? null,
|
||||||
fetchzip ? null,
|
fetchzip ? null,
|
||||||
|
nixpkgs-bootstrap-updater ? null,
|
||||||
stdenv ? null,
|
stdenv ? null,
|
||||||
unstableGitUpdater ? null,
|
|
||||||
#VVV config
|
#VVV config
|
||||||
localSystem ? if stdenv != null then stdenv.buildPlatform.system else builtins.currentSystem, #< not available in pure mode
|
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,
|
system ? if stdenv != null then stdenv.hostPlatform.system else localSystem,
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
optionalAttrs = cond: attrs: if cond then attrs else {};
|
||||||
# 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.
|
||||||
sentinelSha256 = "sha256-AzH1rZFqEH8sovZZfJykvsEmCedEZWigQFHWHl6/PdE=";
|
sentinelSha256 = "sha256-AzH1rZFqEH8sovZZfJykvsEmCedEZWigQFHWHl6/PdE=";
|
||||||
fetchBootstrap = { url, pname, version, ... }@args: {
|
fetchBootstrap = { url, pname, version, ... }@args: {
|
||||||
@@ -128,14 +129,16 @@ let
|
|||||||
in
|
in
|
||||||
"${position.file}:${toString position.line}";
|
"${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 {
|
# 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;
|
||||||
|
# };
|
||||||
|
} // optionalAttrs (nixpkgs-bootstrap-updater != null) {
|
||||||
|
updateScript = nixpkgs-bootstrap-updater.makeUpdateScript {
|
||||||
inherit branch;
|
inherit branch;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -146,11 +149,11 @@ let
|
|||||||
allowUnfree = true; # NIXPKGS_ALLOW_UNFREE=1
|
allowUnfree = true; # NIXPKGS_ALLOW_UNFREE=1
|
||||||
allowBroken = true; # NIXPKGS_ALLOW_BROKEN=1
|
allowBroken = true; # NIXPKGS_ALLOW_BROKEN=1
|
||||||
};
|
};
|
||||||
} // (if (system != localSystem) then {
|
} // optionalAttrs (system != localSystem) {
|
||||||
# XXX(2023/12/11): cache.nixos.org uses `system = ...` instead of `hostPlatform.system`, and that choice impacts the closure of every package.
|
# 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.
|
# so avoid specifying hostPlatform.system on non-cross builds, so i can use upstream caches.
|
||||||
crossSystem = system;
|
crossSystem = system;
|
||||||
} else {});
|
};
|
||||||
nixpkgs = import patchedSrc nixpkgsArgs;
|
nixpkgs = import patchedSrc nixpkgsArgs;
|
||||||
in
|
in
|
||||||
patchedSrc
|
patchedSrc
|
||||||
|
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
static-nix-shell,
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
self = static-nix-shell.mkBash {
|
||||||
|
pname = "nixpkgs-bootstrap-updater";
|
||||||
|
srcRoot = ./.;
|
||||||
|
pkgs = [ "common-updater-scripts" "curl" "jq" "nix-prefetch-github" ];
|
||||||
|
passthru.makeUpdateScript = { branch }: [
|
||||||
|
(lib.getExe self)
|
||||||
|
branch
|
||||||
|
];
|
||||||
|
};
|
||||||
|
in self
|
@@ -0,0 +1,28 @@
|
|||||||
|
#!/usr/bin/env nix-shell
|
||||||
|
#!nix-shell -i bash -p bash -p common-updater-scripts -p curl -p jq -p nix-prefetch-github
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
branch=$1
|
||||||
|
|
||||||
|
if [ -z "$branch" ]; then
|
||||||
|
echo "USAGE: nixpkgsUpdater <branch>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
jsonGetField() {
|
||||||
|
local json=$1
|
||||||
|
local field=$2
|
||||||
|
echo "$json" | jq --exit-status --raw-output ".$field"
|
||||||
|
}
|
||||||
|
|
||||||
|
set -x
|
||||||
|
prefetchData=$(nix-prefetch-github --json --meta --rev "$branch" NixOS nixpkgs)
|
||||||
|
|
||||||
|
rev=$(jsonGetField "$prefetchData" src.rev)
|
||||||
|
nixHash=$(jsonGetField "$prefetchData" src.hash)
|
||||||
|
commitDate=$(jsonGetField "$prefetchData" meta.commitDate)
|
||||||
|
|
||||||
|
update-source-version "sane.nixpkgs-bootstrap.$branch" "unstable-$commitDate" "$nixHash" \
|
||||||
|
--rev="$rev" \
|
||||||
|
--print-changes
|
@@ -7,6 +7,7 @@
|
|||||||
lib.recurseIntoAttrs (lib.makeScope newScope (self: with self; {
|
lib.recurseIntoAttrs (lib.makeScope newScope (self: with self; {
|
||||||
mkNixpkgs = callPackage ./mkNixpkgs.nix { };
|
mkNixpkgs = callPackage ./mkNixpkgs.nix { };
|
||||||
master = callPackage ./master.nix { };
|
master = callPackage ./master.nix { };
|
||||||
|
nixpkgs-bootstrap-updater = callPackage ./nixpkgs-bootstrap-updater { };
|
||||||
staging = callPackage ./staging.nix { };
|
staging = callPackage ./staging.nix { };
|
||||||
staging-next = callPackage ./staging-next.nix { };
|
staging-next = callPackage ./staging-next.nix { };
|
||||||
}))
|
}))
|
||||||
|
Reference in New Issue
Block a user