2023-09-17 19:51:08 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
options,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
2023-07-08 08:16:38 +00:00
|
|
|
# get a list of interfaces
|
|
|
|
interfaces = attrNames config.networking.interfaces;
|
|
|
|
# check if an IP has been assigned
|
|
|
|
has_ip = interface: (length config.networking.interfaces."${interface}".ipv4.addresses) != 0;
|
|
|
|
in {
|
|
|
|
config = {
|
2023-11-16 01:09:35 +00:00
|
|
|
skynet.lxc = false;
|
|
|
|
|
2023-07-08 08:16:38 +00:00
|
|
|
assertions = [
|
|
|
|
{
|
|
|
|
assertion = lists.any has_ip interfaces;
|
|
|
|
message = "Must have a ip address set";
|
|
|
|
}
|
2023-12-20 16:29:39 +00:00
|
|
|
{
|
|
|
|
assertion = config.networking.hostName != "nixos";
|
|
|
|
message = "Must have networking.hostName set";
|
|
|
|
}
|
2023-07-08 08:16:38 +00:00
|
|
|
];
|
|
|
|
};
|
2023-09-17 19:51:08 +00:00
|
|
|
}
|