nixos-config/common/components/networking.nix

59 lines
1.2 KiB
Nix
Raw Normal View History

2024-08-07 16:33:11 +02:00
{config, ...}: {
age.secrets.nm-secrets = {
file = ../../crypto/nm-secrets.age;
owner = "root";
group = "root";
};
2024-04-22 21:01:29 +02:00
networking = {
networkmanager = {
enable = true;
2024-04-22 21:24:54 +02:00
2024-04-22 21:01:29 +02:00
# Randomize MAC for every ethernet connetion
ethernet.macAddress = "random";
connectionConfig = {
# IPv6 Privacy Extensions
"ipv6.ip6-privacy" = 2;
# unique DUID per connection
"ipv6.dhcp-duid" = "stable-uuid";
};
2024-08-07 16:33:11 +02:00
ensureProfiles = {
environmentFiles = [
config.age.secrets.nm-secrets.path
];
profiles = {
Starlink = {
connection = {
id = "Starlink";
type = "wifi";
};
ipv4 = {
method = "auto";
};
ipv6 = {
addr-gen-mode = "stable-privacy";
method = "auto";
};
wifi = {
mode = "infrastructure";
ssid = "Starlink";
};
wifi-security = {
key-mgmt = "wpa-psk";
psk = "$STARLINK_PSK";
};
};
};
};
2024-04-22 21:01:29 +02:00
};
firewall = {
enable = true;
trustedInterfaces = ["tailscale0"];
};
};
}