flake/ci: fix lazy eval of dev partition

If the `ci` options are a set of options rather than a single option,
then the module system cannot lazily override it via `mkForce`.

In practice, this means that the dev partition gets evaluated strictly
when the module system "pushes down" the `ci` definitions to its
options.

Instead, we must ensure that each attribute listed in `partitionedAttrs`
corresponds to an actual option which can be directly defined, with no
"pushing down" required.

Fixes #3532

(cherry picked from commit 67785f9577)
This commit is contained in:
Matt Sturgeon 2025-07-08 14:46:19 +01:00
parent 76d059bac2
commit a11133507a

View file

@ -4,9 +4,13 @@ let
mapAttrs mapAttrs
types types
; ;
in
buildbotOpt = lib.mkOption { {
type = types.lazyAttrsOf types.package; perSystem = {
# per-system CI options
options.ci = {
buildbot = lib.mkOption {
type = types.lazyAttrsOf types.raw;
default = { }; default = { };
description = '' description = ''
A set of tests for [buildbot] to run. A set of tests for [buildbot] to run.
@ -14,28 +18,26 @@ let
[buildbot]: https://buildbot.nix-community.org [buildbot]: https://buildbot.nix-community.org
''; '';
}; };
in
{
perSystem = {
# Declare per-system CI options
options.ci = {
buildbot = buildbotOpt;
}; };
}; };
flake = { flake = {
# Declare top-level CI options # top-level CI option
options.ci = { #
buildbot = lib.mkOption { # NOTE:
type = types.lazyAttrsOf buildbotOpt.type; # This must be an actual option, NOT a set of options.
# Otherwise, flake partitions will not be lazy.
options.ci = lib.mkOption {
type = types.lazyAttrsOf (types.lazyAttrsOf types.raw);
default = { }; default = { };
description = '' description = ''
See `perSystem.ci.buildbot` for description and examples. Outputs related to CI.
Usually defined via the `perSystem.ci` options.
''; '';
}; };
};
# Transpose per-system CI outputs to the top-level # Transpose per-system definitions to the top-level
config.ci = { config.ci = {
buildbot = mapAttrs (_: sysCfg: sysCfg.ci.buildbot) config.allSystems; buildbot = mapAttrs (_: sysCfg: sysCfg.ci.buildbot) config.allSystems;
}; };