Skip to content

Commit f8fa627

Browse files
committed
contianer: Only check visible roles in assertion
The assertion broke evaluation when trying to evaluate a role which is deprecated with mkRemovedOptionModule
1 parent 3551c95 commit f8fa627

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

nixos/infrastructure/container.nix

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
let
44
fclib = config.fclib;
5+
6+
# Only check "visible" roles, skipping roles that are marked as removed by
7+
# `mkRemovedOptionModule` or manually set to `visible = false`.
8+
# The `tryEval` is needed because visiting the role option throws an error if
9+
# the option is declared by `mkRemovedOptionModule`.
10+
visibleFCRoles = (lib.filterAttrs
11+
(n: v: (builtins.tryEval v.enable.visible or true).value)
12+
config.flyingcircus.roles);
513
in
614
{
715
config = lib.mkMerge [
@@ -18,7 +26,7 @@ in
1826
# the option is declared by `mkRemovedOptionModule`.
1927
(lib.filterAttrs
2028
(n: v: (builtins.tryEval v.enable.visible or true).value)
21-
config.flyingcircus.roles);
29+
visibleFCRoles);
2230
}
2331

2432
(lib.mkIf (config.flyingcircus.infrastructureModule == "container") {
@@ -30,7 +38,7 @@ in
3038
{ assertion = if (v.enable or false) then
3139
(v.supportsContainers or true) else true;
3240
message = "role ${n} does not support containers";
33-
}) config.flyingcircus.roles;
41+
}) visibleFCRoles;
3442

3543
boot.isContainer = true;
3644

0 commit comments

Comments
 (0)