diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix
index d5d2a7d8b878..d04937004777 100644
--- a/nixos/modules/services/misc/nix-daemon.nix
+++ b/nixos/modules/services/misc/nix-daemon.nix
@@ -555,6 +555,22 @@ in
+ "\n"
) cfg.buildMachines;
};
+ assertions =
+ let badMachine = m: m.system == null && m.systems == [];
+ in [
+ {
+ assertion = !(builtins.any badMachine cfg.buildMachines);
+ message = ''
+ At least one system type (via system or
+ systems) must be set for every build machine.
+ Invalid machine specifications:
+ '' + " " +
+ (builtins.concatStringsSep "\n "
+ (builtins.map (m: m.hostName)
+ (builtins.filter (badMachine) cfg.buildMachines)));
+ }
+ ];
+
systemd.packages = [ nix ];