nixos-config/hosts/thinkpad/modules/networks/default.nix

49 lines
1.3 KiB
Nix
Raw Normal View History

{ config, ... }:
{
imports = [ ./uni.nix ];
2022-12-30 11:02:10 +01:00
sops.secrets = {
"wireless-env" = { };
"wireguard/dorm/private" = { };
"wireguard/dorm/preshared" = { };
};
networking = {
hostName = "thinkpad";
2022-12-31 14:07:10 +01:00
firewall.allowedTCPPortRanges = [ { from = 1714; to = 1764; } ]; # open ports for kde connect
firewall.allowedUDPPortRanges = [ { from = 1714; to = 1764; } ];
wireless = {
enable = true;
userControlled.enable = true;
environmentFile = config.sops.secrets."wireless-env".path;
networks = {
"@HOME_SSID@" = {
psk = "@HOME_PSK@";
authProtocols = [ "WPA-PSK" ];
};
"@DORM_SSID@" = {
psk = "@DORM_PSK@";
authProtocols = [ "WPA-PSK" ];
2022-12-30 22:44:05 +01:00
extraConfig = "disabled=1";
};
};
};
2022-12-30 11:02:10 +01:00
wg-quick.interfaces = {
Dorm = {
address = [ "10.10.10.3/32" ];
2022-12-30 11:08:39 +01:00
privateKeyFile = config.sops.secrets."wireguard/dorm/private".path;
2022-12-30 11:02:10 +01:00
listenPort = 51820;
dns = [ "192.168.10.1" ];
autostart = false;
peers = [
{
publicKey = "vUmworuJFHjB4KUdkucQ+nzqO2ysARLomq4UuK1n430=";
2022-12-30 11:08:39 +01:00
presharedKeyFile = config.sops.secrets."wireguard/dorm/preshared".path;
2022-12-30 11:02:10 +01:00
allowedIPs = [ "0.0.0.0/0" ];
endpoint = "dorm.vpn.rfive.de:51820";
}
];
};
};
};
}