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 = {
warnings = concatLists (mapAttrsToList (name: service:
let
type = service.serviceConfig.Type or "";
restart = service.serviceConfig.Restart or "no";
in optional
(type == "oneshot" && (restart == "always" || restart == "on-success"))
"Service '${name}.service' with 'Type=oneshot' cannot have 'Restart=always' or 'Restart=on-success'")
cfg.services);
warnings = concatLists (
mapAttrsToList
(name: service:
let
type = service.serviceConfig.Type or "";
restart = service.serviceConfig.Restart or "no";
in
concatLists [
(optional (type == "oneshot" && (restart == "always" || restart == "on-success"))
"Service '${name}.service' with 'Type=oneshot' cannot have 'Restart=always' or 'Restart=on-success'"
)
]
)
cfg.services
);
system.build.units = cfg.units;