2024-11-16 19:00:06 +05:30
|
|
|
{ lib, config, ... }:
|
|
|
|
let
|
|
|
|
wireguard-peers = import ../shared/wireguard-peers.nix;
|
|
|
|
in
|
|
|
|
{
|
2024-07-07 00:24:14 +05:30
|
|
|
sops.secrets = {
|
|
|
|
"wireguard/rico1/pk" = {
|
|
|
|
mode = "400";
|
|
|
|
owner = config.users.users.root.name;
|
|
|
|
group = config.users.users.root.group;
|
|
|
|
};
|
2024-11-16 19:00:06 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
systemd = {
|
|
|
|
network = {
|
|
|
|
enable = true;
|
|
|
|
wait-online.enable = false;
|
|
|
|
networks = {
|
|
|
|
"41-ether" = {
|
|
|
|
enable = true;
|
|
|
|
matchConfig = {
|
|
|
|
Type = "ether";
|
|
|
|
Name = "e*";
|
|
|
|
};
|
|
|
|
networkConfig = {
|
|
|
|
DHCP = "yes";
|
|
|
|
IPv4Forwarding = "yes";
|
|
|
|
};
|
|
|
|
dhcpV4Config = {
|
|
|
|
UseDomains = true;
|
|
|
|
};
|
|
|
|
linkConfig = {
|
|
|
|
RequiredForOnline = "yes";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-06-25 00:23:05 +05:30
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-11-16 19:00:06 +05:30
|
|
|
services.resolved = {
|
2024-06-25 00:23:05 +05:30
|
|
|
enable = true;
|
2024-11-16 19:00:06 +05:30
|
|
|
domains = [ "~." ];
|
|
|
|
fallbackDns = [ ];
|
|
|
|
};
|
|
|
|
|
|
|
|
networking = {
|
|
|
|
useDHCP = lib.mkDefault false;
|
|
|
|
nameservers = [
|
|
|
|
"10.10.10.11"
|
|
|
|
"10.10.10.12"
|
2024-07-07 00:24:14 +05:30
|
|
|
];
|
2024-11-16 19:00:06 +05:30
|
|
|
useNetworkd = true;
|
|
|
|
firewall = {
|
|
|
|
allowedUDPPorts = [ 51831 ];
|
|
|
|
trustedInterfaces = [ "Homelab" ];
|
|
|
|
};
|
|
|
|
wg-quick = {
|
|
|
|
interfaces = {
|
|
|
|
Homelab = {
|
|
|
|
listenPort = 51831;
|
|
|
|
privateKeyFile = config.sops.secrets."wireguard/rico1/pk".path;
|
|
|
|
address = [
|
|
|
|
"10.10.10.11/24"
|
|
|
|
];
|
|
|
|
dns = [ "10.10.10.11" "10.10.10.12" ];
|
|
|
|
peers = with wireguard-peers; [
|
|
|
|
(bifrost // { persistentKeepalive = 20; })
|
|
|
|
rico0
|
|
|
|
rico2
|
|
|
|
wynne
|
|
|
|
layne
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-06-25 00:23:05 +05:30
|
|
|
};
|
|
|
|
}
|