nixos/modules: Reformat warnings section

This commit is contained in:
Niklas Hambüchen 2020-10-31 16:50:25 +01:00
parent b37bbca521
commit c178fe4bbb

View File

@ -886,14 +886,21 @@ in
config = { config = {
warnings = concatLists (mapAttrsToList (name: service: warnings = concatLists (
mapAttrsToList
(name: service:
let let
type = service.serviceConfig.Type or ""; type = service.serviceConfig.Type or "";
restart = service.serviceConfig.Restart or "no"; restart = service.serviceConfig.Restart or "no";
in optional in
(type == "oneshot" && (restart == "always" || restart == "on-success")) concatLists [
"Service '${name}.service' with 'Type=oneshot' cannot have 'Restart=always' or 'Restart=on-success'") (optional (type == "oneshot" && (restart == "always" || restart == "on-success"))
cfg.services); "Service '${name}.service' with 'Type=oneshot' cannot have 'Restart=always' or 'Restart=on-success'"
)
]
)
cfg.services
);
system.build.units = cfg.units; system.build.units = cfg.units;