server-configs/shared/modules/assert_systemd_service.nix

17 lines
419 B
Nix

{ config, lib, ... }:
{
options.mine.assertSystemdService = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [];
};
config = {
assertions = lib.forEach config.mine.assertSystemdService (v: let
c = config.systemd.services."${v}";
in {
assertion = c.script != "" || (c.serviceConfig ? ExecStart);
message = "Systemd service ${v} does not exists";
});
};
}