2023-09-14 14:57:38 +00:00
|
|
|
{ config, lib, ... }:
|
|
|
|
{
|
2024-02-06 16:44:13 +00:00
|
|
|
options.clan = {
|
|
|
|
networking = {
|
|
|
|
targetHost = lib.mkOption {
|
|
|
|
description = ''
|
|
|
|
The target SSH node for deployment.
|
2023-09-14 14:57:38 +00:00
|
|
|
|
2024-02-06 16:44:13 +00:00
|
|
|
By default, the node's attribute name will be used.
|
|
|
|
If set to null, only local deployment will be supported.
|
2023-09-21 13:21:19 +00:00
|
|
|
|
2024-02-06 16:44:13 +00:00
|
|
|
format: user@host:port&SSH_OPTION=SSH_VALUE
|
|
|
|
examples:
|
|
|
|
- machine.example.com
|
|
|
|
- user@machine2.example.com
|
|
|
|
- root@example.com:2222&IdentityFile=/path/to/private/key
|
|
|
|
'';
|
|
|
|
default = null;
|
|
|
|
type = lib.types.nullOr lib.types.str;
|
|
|
|
};
|
|
|
|
buildHost = lib.mkOption {
|
|
|
|
description = ''
|
|
|
|
The build SSH node where nixos-rebuild will be executed.
|
|
|
|
|
|
|
|
If set to null, the targetHost will be used.
|
|
|
|
|
|
|
|
format: user@host:port&SSH_OPTION=SSH_VALUE
|
|
|
|
examples:
|
|
|
|
- machine.example.com
|
|
|
|
- user@machine2.example.com
|
|
|
|
- root@example.com:2222&IdentityFile=/path/to/private/key
|
|
|
|
'';
|
|
|
|
type = lib.types.nullOr lib.types.str;
|
|
|
|
default = null;
|
|
|
|
};
|
2024-02-02 04:32:48 +00:00
|
|
|
};
|
|
|
|
|
2024-02-06 16:44:13 +00:00
|
|
|
deployment = {
|
|
|
|
requireExplicitUpdate = lib.mkOption {
|
|
|
|
description = ''
|
|
|
|
Do not update this machine when running `clan machines update` without any machines specified.
|
2024-02-02 04:32:48 +00:00
|
|
|
|
2024-02-06 16:44:13 +00:00
|
|
|
This is useful for machines that are not always online or are not part of the regular update cycle.
|
|
|
|
'';
|
|
|
|
type = lib.types.bool;
|
|
|
|
default = false;
|
|
|
|
};
|
2023-09-14 14:57:38 +00:00
|
|
|
};
|
|
|
|
};
|
2024-02-06 16:44:13 +00:00
|
|
|
|
2024-02-02 04:32:48 +00:00
|
|
|
imports = [
|
2024-03-17 18:48:49 +00:00
|
|
|
(lib.mkRenamedOptionModule
|
|
|
|
[
|
|
|
|
"clan"
|
|
|
|
"networking"
|
|
|
|
"deploymentAddress"
|
|
|
|
]
|
|
|
|
[
|
|
|
|
"clan"
|
|
|
|
"networking"
|
|
|
|
"targetHost"
|
|
|
|
]
|
|
|
|
)
|
2024-02-02 04:32:48 +00:00
|
|
|
];
|
2023-11-15 05:54:29 +00:00
|
|
|
config = {
|
|
|
|
# conflicts with systemd-resolved
|
|
|
|
networking.useHostResolvConf = false;
|
|
|
|
|
2023-11-15 10:04:03 +00:00
|
|
|
# Allow PMTU / DHCP
|
|
|
|
networking.firewall.allowPing = true;
|
|
|
|
|
2023-11-15 05:54:29 +00:00
|
|
|
# The notion of "online" is a broken concept
|
|
|
|
# https://github.com/systemd/systemd/blob/e1b45a756f71deac8c1aa9a008bd0dab47f64777/NEWS#L13
|
|
|
|
systemd.services.NetworkManager-wait-online.enable = false;
|
|
|
|
systemd.network.wait-online.enable = false;
|
|
|
|
|
2024-04-17 08:56:37 +00:00
|
|
|
systemd.network.networks."99-ethernet-default-dhcp".networkConfig.MulticastDNS = lib.mkDefault "yes";
|
|
|
|
systemd.network.networks."99-wireless-client-dhcp".networkConfig.MulticastDNS = lib.mkDefault "yes";
|
|
|
|
networking.firewall.allowedUDPPorts = [ 5353 ]; # Multicast DNS
|
2024-04-09 13:29:40 +00:00
|
|
|
|
2023-11-15 05:54:29 +00:00
|
|
|
# Use networkd instead of the pile of shell scripts
|
|
|
|
networking.useNetworkd = lib.mkDefault true;
|
|
|
|
};
|
2023-09-14 14:57:38 +00:00
|
|
|
}
|