2024-04-10 00:33:33 +02:00
|
|
|
{ pkgs, config, lib, ... }:
|
2022-12-29 15:05:26 +01:00
|
|
|
{
|
|
|
|
imports = [ ./uni.nix ];
|
|
|
|
|
2023-11-16 13:29:18 +01:00
|
|
|
age.secrets = {
|
|
|
|
wireless = {
|
|
|
|
file = ../../../../secrets/thinkpad/wireless.age;
|
|
|
|
};
|
2023-01-15 02:28:40 +01:00
|
|
|
"wireguard/dorm/private" = {
|
2023-11-16 13:29:18 +01:00
|
|
|
file = ../../../../secrets/thinkpad/wireguard/dorm/private.age;
|
2023-01-15 02:28:40 +01:00
|
|
|
owner = config.users.users.systemd-network.name;
|
|
|
|
};
|
|
|
|
"wireguard/dorm/preshared" = {
|
2023-11-16 13:29:18 +01:00
|
|
|
file = ../../../../secrets/thinkpad/wireguard/dorm/preshared.age;
|
2023-01-15 02:28:40 +01:00
|
|
|
owner = config.users.users.systemd-network.name;
|
|
|
|
};
|
2023-11-16 13:29:18 +01:00
|
|
|
|
2022-12-30 11:02:10 +01:00
|
|
|
};
|
2023-11-24 09:19:06 +01:00
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
mtr
|
|
|
|
whois
|
|
|
|
inetutils
|
|
|
|
openssl
|
|
|
|
dnsutils
|
2024-01-04 00:10:15 +01:00
|
|
|
nmap
|
2024-02-11 20:01:15 +01:00
|
|
|
curlFull
|
2024-02-18 17:08:02 +01:00
|
|
|
wireguard-tools
|
2024-04-18 19:49:10 +02:00
|
|
|
etherape
|
2023-11-24 09:19:06 +01:00
|
|
|
];
|
2024-04-10 00:33:33 +02:00
|
|
|
services.timesyncd.servers = lib.mkForce [ ];
|
2023-09-29 10:32:24 +02:00
|
|
|
services.resolved = {
|
|
|
|
fallbackDns = [
|
|
|
|
"9.9.9.9"
|
|
|
|
"149.112.112.112"
|
|
|
|
"2620:fe::fe"
|
|
|
|
"2620:fe::9"
|
|
|
|
];
|
|
|
|
# allow downgrade since fritzbox at home doesn't support it (yet?)
|
2024-08-22 11:39:42 +02:00
|
|
|
# dnssec = "allow-downgrade";
|
2023-09-29 10:32:24 +02:00
|
|
|
};
|
2023-04-12 22:09:46 +02:00
|
|
|
networking = {
|
2023-10-26 12:12:45 +02:00
|
|
|
nftables.enable = true;
|
2023-04-12 22:09:46 +02:00
|
|
|
useNetworkd = true;
|
2022-12-29 15:05:26 +01:00
|
|
|
hostName = "thinkpad";
|
2023-08-02 18:04:26 +02:00
|
|
|
hostId = "d8d34032";
|
2023-04-12 15:05:15 +02:00
|
|
|
enableIPv6 = true;
|
2022-12-29 15:05:26 +01:00
|
|
|
wireless = {
|
|
|
|
enable = true;
|
|
|
|
userControlled.enable = true;
|
2023-12-24 23:40:01 +01:00
|
|
|
# sadly broken on my machine
|
|
|
|
scanOnLowSignal = false;
|
2023-11-16 13:29:18 +01:00
|
|
|
environmentFile = config.age.secrets.wireless.path;
|
2022-12-29 15:05:26 +01:00
|
|
|
networks = {
|
|
|
|
"@HOME_SSID@" = {
|
|
|
|
psk = "@HOME_PSK@";
|
|
|
|
authProtocols = [ "WPA-PSK" ];
|
|
|
|
};
|
|
|
|
"@DORM_SSID@" = {
|
|
|
|
psk = "@DORM_PSK@";
|
2023-10-13 00:28:39 +02:00
|
|
|
authProtocols = [ "SAE" ];
|
2024-04-10 00:33:33 +02:00
|
|
|
extraConfig = "disabled=1";
|
2022-12-29 15:05:26 +01:00
|
|
|
};
|
2023-11-20 22:46:51 +01:00
|
|
|
"@DORM5_SSID@" = {
|
|
|
|
priority = 5;
|
|
|
|
psk = "@DORM_PSK@";
|
|
|
|
authProtocols = [ "SAE" ];
|
2024-04-10 00:33:33 +02:00
|
|
|
extraConfig = "disabled=1";
|
2023-11-20 22:46:51 +01:00
|
|
|
};
|
2024-08-13 11:38:01 +02:00
|
|
|
"LKG-Gast" = {
|
|
|
|
psk = "@LKGDD_GUEST_PSK@";
|
|
|
|
authProtocols = [ "WPA-PSK" ];
|
|
|
|
};
|
2023-04-14 11:14:53 +02:00
|
|
|
"@PIXEL_SSID@" = {
|
|
|
|
psk = "@PIXEL_PSK@";
|
|
|
|
authProtocols = [ "WPA-PSK" ];
|
|
|
|
};
|
2023-12-17 17:22:12 +01:00
|
|
|
"WIFI@DB" = {
|
|
|
|
authProtocols = [ "NONE" ];
|
|
|
|
};
|
2022-12-29 15:05:26 +01:00
|
|
|
};
|
|
|
|
};
|
2023-01-15 02:28:40 +01:00
|
|
|
};
|
|
|
|
systemd.network = {
|
|
|
|
enable = true;
|
2023-12-23 17:30:24 +01:00
|
|
|
wait-online.enable = false;
|
|
|
|
config = {
|
|
|
|
networkConfig = {
|
|
|
|
SpeedMeter = true;
|
|
|
|
};
|
|
|
|
};
|
2023-01-15 14:27:49 +01:00
|
|
|
networks."10-loopback" = {
|
|
|
|
matchConfig.Name = "lo";
|
|
|
|
};
|
2023-10-22 15:45:30 +02:00
|
|
|
networks."10-wired-default" = {
|
|
|
|
matchConfig.Name = "en*";
|
2023-02-14 19:49:31 +01:00
|
|
|
linkConfig.RequiredForOnline = false;
|
2023-01-15 14:27:49 +01:00
|
|
|
networkConfig = {
|
|
|
|
DHCP = "yes";
|
2023-05-30 17:33:15 +02:00
|
|
|
IPv6AcceptRA = "yes";
|
|
|
|
IPv6PrivacyExtensions = "yes";
|
2023-01-15 02:28:40 +01:00
|
|
|
};
|
2023-01-15 14:27:49 +01:00
|
|
|
dhcpV4Config = {
|
|
|
|
RouteMetric = 10;
|
2023-01-15 02:28:40 +01:00
|
|
|
};
|
|
|
|
};
|
2023-01-15 14:58:38 +01:00
|
|
|
networks."10-wireless-home" = {
|
|
|
|
matchConfig = {
|
|
|
|
Name = "wlp9s0";
|
2023-04-06 11:00:53 +02:00
|
|
|
SSID = "Smoerrebroed";
|
2023-01-15 14:58:38 +01:00
|
|
|
};
|
|
|
|
networkConfig = {
|
|
|
|
DHCP = "yes";
|
|
|
|
IgnoreCarrierLoss = "3s";
|
2023-09-24 21:32:28 +02:00
|
|
|
IPv6AcceptRA = "yes";
|
|
|
|
IPv6PrivacyExtensions = "yes";
|
2023-01-15 14:58:38 +01:00
|
|
|
};
|
|
|
|
dhcpV4Config = {
|
|
|
|
RouteMetric = 20;
|
|
|
|
};
|
|
|
|
routes = [
|
|
|
|
# Route to the Model train network via raspi
|
2023-12-23 17:30:24 +01:00
|
|
|
{
|
2024-06-10 10:21:00 +02:00
|
|
|
Gateway = "192.168.178.63";
|
|
|
|
GatewayOnLink = true;
|
|
|
|
Destination = "192.168.179.0/24";
|
2023-12-23 17:30:24 +01:00
|
|
|
}
|
2023-01-15 14:58:38 +01:00
|
|
|
];
|
|
|
|
};
|
|
|
|
networks."15-wireless-default" = {
|
2023-01-15 14:27:49 +01:00
|
|
|
matchConfig.Name = "wlp9s0";
|
|
|
|
networkConfig = {
|
|
|
|
DHCP = "yes";
|
|
|
|
IgnoreCarrierLoss = "3s";
|
2023-04-12 15:05:15 +02:00
|
|
|
IPv6AcceptRA = "yes";
|
2023-05-30 17:33:15 +02:00
|
|
|
IPv6PrivacyExtensions = "yes";
|
2023-01-15 02:28:40 +01:00
|
|
|
};
|
2023-01-15 14:27:49 +01:00
|
|
|
dhcpV4Config = {
|
|
|
|
RouteMetric = 20;
|
2022-12-30 11:02:10 +01:00
|
|
|
};
|
2023-04-12 15:05:15 +02:00
|
|
|
|
2022-12-30 11:02:10 +01:00
|
|
|
};
|
2023-01-15 02:28:40 +01:00
|
|
|
|
2023-10-22 15:45:30 +02:00
|
|
|
netdevs."30-wg0" = {
|
2023-01-15 14:27:49 +01:00
|
|
|
netdevConfig = {
|
|
|
|
Kind = "wireguard";
|
2023-10-22 15:45:30 +02:00
|
|
|
Name = "wg0";
|
2023-01-15 14:27:49 +01:00
|
|
|
};
|
|
|
|
wireguardConfig = {
|
2023-11-16 13:29:18 +01:00
|
|
|
PrivateKeyFile = config.age.secrets."wireguard/dorm/private".path;
|
2023-01-15 14:27:49 +01:00
|
|
|
ListenPort = 51820;
|
2023-12-23 17:30:24 +01:00
|
|
|
RouteTable = "main";
|
|
|
|
RouteMetric = 30;
|
2023-01-15 14:27:49 +01:00
|
|
|
};
|
|
|
|
wireguardPeers = [
|
|
|
|
{
|
2024-06-10 10:21:00 +02:00
|
|
|
PublicKey = "Z5lwwHTCDr6OF4lfaCdSHNveunOn4RzuOQeyB+El9mQ=";
|
|
|
|
PresharedKeyFile = config.age.secrets."wireguard/dorm/preshared".path;
|
|
|
|
Endpoint = "nuc.rfive.de:51820";
|
|
|
|
AllowedIPs = "192.168.42.0/24, 192.168.43.0/24";
|
2023-01-15 14:27:49 +01:00
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2023-10-22 15:45:30 +02:00
|
|
|
networks."30-wg0" = {
|
|
|
|
matchConfig.Name = "wg0";
|
2024-04-10 00:33:33 +02:00
|
|
|
linkConfig.RequiredForOnline = false;
|
2024-04-26 10:37:13 +02:00
|
|
|
addresses = [
|
|
|
|
{
|
2024-06-10 10:21:00 +02:00
|
|
|
Address = "192.168.43.3/24";
|
|
|
|
AddPrefixRoute = false;
|
2024-04-26 10:37:13 +02:00
|
|
|
}
|
|
|
|
];
|
2023-05-05 23:43:40 +02:00
|
|
|
networkConfig = {
|
2024-01-04 00:10:15 +01:00
|
|
|
DNS = "192.168.43.1";
|
2024-04-18 19:49:10 +02:00
|
|
|
Domains = [
|
|
|
|
"~vpn.rfive.de"
|
|
|
|
"~42.168.192.in-addr.arpa"
|
|
|
|
"~43.168.192.in-addr.arpa"
|
|
|
|
];
|
2024-04-01 14:23:43 +02:00
|
|
|
DNSSEC = false;
|
2023-05-05 23:43:40 +02:00
|
|
|
};
|
2023-01-15 14:27:49 +01:00
|
|
|
};
|
2022-12-29 15:05:26 +01:00
|
|
|
};
|
2023-11-24 09:57:15 +01:00
|
|
|
programs.wireshark = {
|
|
|
|
enable = true;
|
|
|
|
package = pkgs.wireshark-qt;
|
|
|
|
};
|
|
|
|
users.groups.etherape = { };
|
|
|
|
security.wrappers.etherape = {
|
|
|
|
source = "${pkgs.etherape}/bin/etherape";
|
|
|
|
capabilities = "cap_net_raw,cap_net_admin+eip";
|
|
|
|
owner = "root";
|
2024-06-10 10:21:00 +02:00
|
|
|
group = "etherape";
|
2023-11-24 09:57:15 +01:00
|
|
|
permissions = "u+rx,g+x";
|
|
|
|
};
|
2022-12-29 15:05:26 +01:00
|
|
|
}
|