Skip to content

Commit a111335

Browse files
committed
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 67785f9)
1 parent 76d059b commit a111335

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed

flake/ci.nix

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,40 @@ let
44
mapAttrs
55
types
66
;
7-
8-
buildbotOpt = lib.mkOption {
9-
type = types.lazyAttrsOf types.package;
10-
default = { };
11-
description = ''
12-
A set of tests for [buildbot] to run.
13-
14-
[buildbot]: https://buildbot.nix-community.org
15-
'';
16-
};
177
in
188
{
199
perSystem = {
20-
# Declare per-system CI options
21-
options.ci = {
22-
buildbot = buildbotOpt;
23-
};
24-
};
25-
26-
flake = {
27-
# Declare top-level CI options
10+
# per-system CI options
2811
options.ci = {
2912
buildbot = lib.mkOption {
30-
type = types.lazyAttrsOf buildbotOpt.type;
13+
type = types.lazyAttrsOf types.raw;
3114
default = { };
3215
description = ''
33-
See `perSystem.ci.buildbot` for description and examples.
16+
A set of tests for [buildbot] to run.
17+
18+
[buildbot]: https://buildbot.nix-community.org
3419
'';
3520
};
3621
};
22+
};
23+
24+
flake = {
25+
# top-level CI option
26+
#
27+
# NOTE:
28+
# This must be an actual option, NOT a set of options.
29+
# Otherwise, flake partitions will not be lazy.
30+
options.ci = lib.mkOption {
31+
type = types.lazyAttrsOf (types.lazyAttrsOf types.raw);
32+
default = { };
33+
description = ''
34+
Outputs related to CI.
35+
36+
Usually defined via the `perSystem.ci` options.
37+
'';
38+
};
3739

38-
# Transpose per-system CI outputs to the top-level
40+
# Transpose per-system definitions to the top-level
3941
config.ci = {
4042
buildbot = mapAttrs (_: sysCfg: sysCfg.ci.buildbot) config.allSystems;
4143
};

0 commit comments

Comments
 (0)