configuration.nix/hosts/rico1/network/wireguard.nix

47 lines
1.1 KiB
Nix
Raw Normal View History

{ config, ... }:
2024-12-07 02:28:11 +05:30
let wireguard-peers = import ../../shared/wireguard-peers.nix { }; in {
2024-11-16 22:10:11 +05:30
sops.secrets = {
"wireguard/rico1/pk" = {
mode = "400";
2024-12-07 02:28:11 +05:30
owner = config.users.users.systemd-network.name;
group = config.users.users.systemd-network.group;
2024-11-16 22:10:11 +05:30
};
};
networking = {
firewall = {
allowedUDPPorts = [ 51831 ];
trustedInterfaces = [ "Homelab" ];
};
2024-12-07 02:28:11 +05:30
};
systemd.network = {
netdevs."99-Homelab" = {
netdevConfig = {
Name = "Homelab";
Kind = "wireguard";
};
wireguardConfig = {
ListenPort = 51831;
PrivateKeyFile = config.sops.secrets."wireguard/rico1/pk".path;
};
wireguardPeers = with wireguard-peers; [
(bifrost // { PersistentKeepalive = 20; })
rico0
rico2
wynne
layne
];
};
networks."99-Homelab" = {
matchConfig = {
Name = "Homelab";
};
networkConfig = {
DNS = "10.10.10.1";
Address = [
"${config.nodeconfig.facts.wireguard-ip}/24"
];
2024-11-16 22:10:11 +05:30
};
};
};
}