modules.systemd_assert_service: ensures a service exists, disabled

This commit is contained in:
eyjhb 2024-08-12 23:34:31 +02:00
parent 85a64902af
commit ce2f6d2cb5
No known key found for this signature in database
GPG key ID: 609F508E3239F920
2 changed files with 18 additions and 0 deletions

View file

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

View file

@ -1,6 +1,7 @@
{
imports = [
./shared.nix
# ./assert_systemd_service.nix
./zrepl.nix
./disko.nix