2020-04-18 21:04:14 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
{
|
2020-05-14 02:09:23 +02:00
|
|
|
# Set hostname, hostid and enable WiFi
|
2020-04-18 21:04:14 +02:00
|
|
|
networking = {
|
|
|
|
hostName = "panacea";
|
2020-05-08 21:53:52 +02:00
|
|
|
hostId = "8feb0bb8";
|
2020-12-20 20:54:53 +01:00
|
|
|
wireless.iwd.enable = true;
|
2020-04-18 21:04:14 +02:00
|
|
|
};
|
|
|
|
|
2022-03-28 18:08:23 +02:00
|
|
|
# Enable systemd-networkd
|
|
|
|
networking = {
|
|
|
|
useDHCP = false;
|
|
|
|
interfaces = {
|
|
|
|
enp0s31f6.useDHCP = true;
|
|
|
|
wlan0.useDHCP = true;
|
|
|
|
};
|
|
|
|
useNetworkd = true;
|
|
|
|
dhcpcd.enable = false;
|
|
|
|
};
|
|
|
|
systemd.services."systemd-networkd-wait-online".enable = false;
|
|
|
|
|
2022-08-16 13:12:34 +02:00
|
|
|
# Disable DNSSEC
|
|
|
|
services.resolved.dnssec = "false";
|
|
|
|
|
2022-04-29 18:12:46 +02:00
|
|
|
# Prioritize ethernet over WiFi
|
|
|
|
systemd.network.networks."40-enp0s31f6".dhcpV4Config.RouteMetric = 10;
|
|
|
|
systemd.network.networks."40-wlan0".dhcpV4Config.RouteMetric = 20;
|
|
|
|
|
2022-03-28 18:08:23 +02:00
|
|
|
# Static IP for home network
|
|
|
|
systemd.network.networks."24-home" = {
|
|
|
|
name = "wlan0";
|
|
|
|
matchConfig = {
|
|
|
|
Name = "wlan0";
|
|
|
|
SSID = "WiFi-5.0-CE42";
|
|
|
|
};
|
2022-07-12 20:49:08 +02:00
|
|
|
address = [ "192.168.13.131/24" ];
|
|
|
|
gateway = [ "192.168.13.1" ];
|
|
|
|
dns = [ "192.168.13.2" ];
|
2022-03-28 18:08:23 +02:00
|
|
|
networkConfig.DNSSEC = "no";
|
|
|
|
};
|
|
|
|
|
2020-04-18 21:04:14 +02:00
|
|
|
# Enable zeroconf
|
|
|
|
services.avahi = {
|
|
|
|
enable = true;
|
|
|
|
nssmdns = true;
|
|
|
|
};
|
2022-08-03 13:52:02 +02:00
|
|
|
|
|
|
|
# VPN setup
|
|
|
|
systemd.network.netdevs."wg0" = {
|
|
|
|
netdevConfig = {
|
|
|
|
Kind = "wireguard";
|
|
|
|
Name = "wg0";
|
|
|
|
};
|
|
|
|
wireguardConfig.PrivateKeyFile = config.age.secrets.wireguard.path;
|
|
|
|
wireguardPeers = [{
|
|
|
|
wireguardPeerConfig = {
|
|
|
|
PublicKey = "GN8lqPBZYOulh6xD4GhkoEWI65HMMCpSxJSH5871YnU=";
|
|
|
|
AllowedIPs = [ "0.0.0.0/0" ];
|
2022-09-08 10:53:41 +02:00
|
|
|
Endpoint = "coolneng.duckdns.org:1194";
|
2022-08-03 13:52:02 +02:00
|
|
|
};
|
|
|
|
}];
|
|
|
|
};
|
|
|
|
systemd.network.networks."wg0" = {
|
|
|
|
matchConfig.Name = "wg0";
|
|
|
|
networkConfig = {
|
|
|
|
Address = "10.8.0.2/32";
|
|
|
|
DNS = "10.8.0.1";
|
|
|
|
};
|
|
|
|
routes = [{ routeConfig.Destination = "10.8.0.1"; }];
|
|
|
|
};
|
2022-09-04 18:35:36 +02:00
|
|
|
|
|
|
|
# Firewall configuration
|
|
|
|
networking.firewall = {
|
|
|
|
allowedTCPPorts = [
|
|
|
|
9090 # Calibre Wireless
|
|
|
|
];
|
|
|
|
allowedUDPPorts = [
|
|
|
|
54982 # Calibre Wireless
|
|
|
|
];
|
|
|
|
};
|
2020-04-18 21:04:14 +02:00
|
|
|
}
|