diff --git a/shared/modules/assert_systemd_service.nix b/shared/modules/assert_systemd_service.nix new file mode 100644 index 0000000..d9df8a2 --- /dev/null +++ b/shared/modules/assert_systemd_service.nix @@ -0,0 +1,17 @@ +{ 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"; + }); + }; +} diff --git a/shared/modules/default.nix b/shared/modules/default.nix index 8006789..bdba0ad 100644 --- a/shared/modules/default.nix +++ b/shared/modules/default.nix @@ -1,6 +1,7 @@ { imports = [ ./shared.nix + # ./assert_systemd_service.nix ./zrepl.nix ./disko.nix