{ 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";
    });
  };
}