configuration.nix/hosts/skipper/network/wireguard.nix

40 lines
1 KiB
Nix
Raw Normal View History

2024-11-16 19:00:06 +05:30
{ config, ... }:
2024-12-07 02:28:11 +05:30
let wireguard-peers = import ../../shared/wireguard-peers.nix { }; in {
2024-07-02 23:20:11 +05:30
sops.secrets = {
"wireguard/skipper/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-07-02 23:20:11 +05:30
};
2024-06-30 18:45:27 +05:30
};
2024-12-08 14:57:43 +05:30
networking.firewall.trustedInterfaces = [ "Homelab" ];
2024-12-07 02:28:11 +05:30
systemd.network = {
enable = true;
netdevs."99-Homelab" = {
netdevConfig = {
Name = "Homelab";
Kind = "wireguard";
};
wireguardConfig = {
ListenPort = 51822;
PrivateKeyFile = config.sops.secrets."wireguard/skipper/pk".path;
};
wireguardPeers = with wireguard-peers; [
(bifrost // { AllowedIPs = [ "10.10.10.0/24" ]; })
];
};
networks."99-Homelab" = {
matchConfig = {
Name = "Homelab";
};
networkConfig = {
DNS = "10.10.10.1";
2024-12-08 14:57:43 +05:30
Domains = [ "labs.adtya.xyz" ];
2024-12-07 02:28:11 +05:30
Address = [
"${config.nodeconfig.facts.wireguard-ip}/24"
];
2024-11-16 19:00:06 +05:30
};
};
2024-03-31 22:28:56 +05:30
};
}