stylix: apply testbed field separator check to each fields (#904)

Fixes: f121a142ab ("stylix: parametrize and change testbed field separator (#887)")
This commit is contained in:
NAHO 2025-02-25 12:59:31 +01:00 committed by GitHub
parent 9d433a6b1a
commit c9195530b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -113,11 +113,6 @@ let
else if testbed == ".nix" then
builtins.throw "testbed must have a name: ${testbed}"
# To prevent ambiguity with the final derivation's hyphen field
# separator, testbed names should not contain hyphens.
else if lib.hasInfix testbedFieldSeparator testbed then
builtins.throw "testbed name must not contain the '${testbedFieldSeparator}' testbed field separator: ${testbed}"
else
{
inherit module;
@ -132,14 +127,23 @@ let
makeTestbed =
testbed: stylix:
let
name = builtins.concatStringsSep testbedFieldSeparator [
"testbed"
testbed.module
testbed.name
stylix.polarity
"image${lib.optionalString (stylix.image or null == null) "less"}"
"scheme${lib.optionalString (stylix.base16Scheme or null == null) "less"}"
];
name = builtins.concatStringsSep testbedFieldSeparator (
map
(
field:
lib.throwIf (lib.hasInfix testbedFieldSeparator field)
"testbed field must not contain the '${testbedFieldSeparator}' testbed field separator: ${field}"
field
)
[
"testbed"
testbed.module
testbed.name
stylix.polarity
"image${lib.optionalString (stylix.image or null == null) "less"}"
"scheme${lib.optionalString (stylix.base16Scheme or null == null) "less"}"
]
);
system = lib.nixosSystem {
inherit (pkgs) system;