Add an assertion to make sure that the services passed to systemd-manager exist.

This commit is contained in:
r-vdp 2023-03-22 11:56:58 +01:00
parent 542f0fea95
commit 19edbdddb1
No known key found for this signature in database

View file

@ -24,15 +24,27 @@
}; };
system.stateVersion = lib.mkDefault lib.trivial.release; system.stateVersion = lib.mkDefault lib.trivial.release;
assertions = lib.flip map config.system-manager.etcFiles (entry: assertions =
{ lib.flip map config.system-manager.etcFiles
assertion = lib.hasAttr entry config.environment.etc; (entry:
message = lib.concatStringsSep " " [ {
"The entry ${entry} that was passed to system-manager.etcFiles" assertion = lib.hasAttr entry config.environment.etc;
"is not present in environment.etc" message = lib.concatStringsSep " " [
]; "The entry ${entry} that was passed to system-manager.etcFiles"
} "is not present in environment.etc"
); ];
}
) ++
lib.flip map config.system-manager.services
(entry:
{
assertion = lib.hasAttr entry config.systemd.services;
message = lib.concatStringsSep " " [
"The entry ${entry} that was passed to system-manager.services"
"is not present in systemd.services"
];
}
);
# Add the system directory for systemd # Add the system directory for systemd
system-manager.etcFiles = [ "systemd/system" ]; system-manager.etcFiles = [ "systemd/system" ];