nixos/nix-daemon: assert system or systems for buildMachines.

Commit 5395397f removed the assertions from the buildMachines to
ensure that either system or systems is set for each buildmachine.

This patch re-implements those assertions.

The symptom is that if both system and systems are omitted, then the
/etc/machines file has the wrong number of columns and any attempt to
run a `nix` operation that has to perform a build will fail with a
`strtoull` exception.
main
Kevin Quick 3 years ago
parent 27693c7205
commit 58921a4904
No known key found for this signature in database
GPG Key ID: E6D7733599CC0A21
  1. 16
      nixos/modules/services/misc/nix-daemon.nix

@ -533,6 +533,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 <varname>system</varname> or
<varname>systems</varname>) 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 ];

Loading…
Cancel
Save