release.nix: init

This is a Hydra jobset definition to be used to warm up a cache with Lix
versions built against several nixpkgs versions. This is only happening
after a bunch of tests have passed.

Change-Id: Id0b0e50c08581f3f377c7c793d2fd83a6007999d
This commit is contained in:
Maximilian Bosch
2026-06-04 16:26:04 +02:00
parent 1c70995b25
commit 82d23e8f1b
+87
View File
@@ -0,0 +1,87 @@
{
systems ? [ "x86_64-linux" ],
nixpkgs ? <nixpkgs>,
lixSrc ? builtins.fetchGit ./.,
}:
let
flakeLock = builtins.fromJSON (builtins.readFile (lixSrc + "/flake.lock"));
fetchFlakeLockInputs =
names:
lib.listToAttrs (
map (
inputName:
let
nodeName = flakeLock.nodes.${flakeLock.root}.inputs.${inputName};
in
lib.nameValuePair inputName (builtins.fetchTree flakeLock.nodes.${nodeName}.locked)
) names
);
lib = import (nixpkgs + "/lib");
filterSystems = lib.filter (n: builtins.elem n systems);
inputs =
(import (lixSrc + "/nix-support/build/inputs.nix") (
fetchFlakeLockInputs [
"nix2container"
"nixpkgs-regression"
"nix_2_18"
]
// {
inherit lib nixpkgs lixSrc;
}
)).overrideScope
(
_: prev: {
linux32BitSystems = filterSystems prev.linux32BitSystems;
linux64BitSystems = filterSystems prev.linux64BitSystems;
darwinSystems = filterSystems prev.darwinSystems;
}
);
outputs = inputs.callPackage (lixSrc + "/nix-support/build/outputs.nix") { };
in
lib.fix (
self:
outputs.ciArtifacts
// {
inherit (outputs) tests;
# Aggregate job that is finished in Hydra _after_ all constituent jobs (here: grouped by system)
# succeed.
# This is used to run CD scripts once all builds are finished on Hydra.
release = inputs.forAllSystems (
system:
let
pkgs = inputs.nixpkgsFor.${system}.native;
in
pkgs.runCommand "release"
{
_hydraAggregate = true;
constituents = lib.filter (x: x != null) (
lib.mapAttrsToListRecursiveCond
(_: val: !(lib.isDerivation val || builtins.any (system': val ? ${system'}) systems))
(
path: drv:
if drv ? ${system} then
lib.concatStringsSep "." (path ++ [ system ])
else if drv.system or null == system then
lib.concatStringsSep "." path
else
null
)
(
removeAttrs self [
"release"
]
)
);
}
''
touch $out
''
);
}
)