nixos-config/linux/nebula/network.nix

56 lines
1.4 KiB
Nix
Raw Normal View History

2023-10-09 10:44:07 -07:00
{ config, ... }:
2023-11-27 13:19:16 -08:00
let const = config.constants; hn = config.networking.hostName; in {
2023-10-09 10:44:07 -07:00
networking = {
domain = config.constants.domain;
2023-11-27 13:19:16 -08:00
firewall.allowedTCPPorts = with const.port; [ http https ];
2023-10-09 10:44:07 -07:00
hostId = "e6449321";
networkmanager = {
enable = true;
wifi.backend = "iwd";
};
nftables.enable = true;
tempAddresses = "disabled";
2023-11-14 20:56:38 -08:00
wireguard.interfaces.wgn = {
ips = [ "10.32.54.3/32" ];
peers = [{
allowedIPs = [ "10.32.54.0/24" ];
2023-11-27 13:19:16 -08:00
endpoint = "${const.domain}:${toString const.port.wireguard-server}";
2023-11-15 14:51:46 -08:00
persistentKeepalive = 54;
publicKey = "0j8+alXU/f2UgWN61R6+Wjs9xelGRwpSbe5NyOwWlF4=";
2023-11-14 20:56:38 -08:00
}];
privateKeyFile = config.sops.secrets."wireguard/${hn}".path;
};
2023-10-09 10:44:07 -07:00
wireless.iwd.enable = true;
};
2023-11-14 20:56:38 -08:00
services = {
cloudflare-dyndns = {
enable = true;
apiTokenFile = config.sops.secrets."cloudflare/${hn}".path;
domains = builtins.attrNames config.services.caddy.virtualHosts;
ipv4 = false;
ipv6 = true;
};
openssh = {
enable = true;
hostKeys = [{
comment = "host@${hn}";
path = "/etc/ssh/host";
rounds = 100;
type = "ed25519";
}];
settings = {
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
};
2023-10-09 10:44:07 -07:00
};
2023-11-14 20:56:38 -08:00
resolved.enable = true;
2023-10-09 10:44:07 -07:00
};
2023-11-14 20:56:38 -08:00
sops.secrets = {
"cloudflare/${hn}" = { };
"wireguard/${hn}" = { };
};
2023-10-09 10:44:07 -07:00
}