modules.systemd_assert_service: ensures a service exists, disabled
This commit is contained in:
parent
85a64902af
commit
ce2f6d2cb5
2 changed files with 18 additions and 0 deletions
17
shared/modules/assert_systemd_service.nix
Normal file
17
shared/modules/assert_systemd_service.nix
Normal 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";
|
||||
});
|
||||
};
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
imports = [
|
||||
./shared.nix
|
||||
# ./assert_systemd_service.nix
|
||||
|
||||
./zrepl.nix
|
||||
./disko.nix
|
||||
|
|
Loading…
Reference in a new issue