nixos-config/modules/network.nix

35 lines
976 B
Nix
Raw Normal View History

2020-05-12 16:06:45 +04:00
{ pkgs, lib, config, ... }:
let
2021-03-16 22:34:46 +04:00
localRanges = [{
from = 1714;
to = 1764;
} # KDE connect
];
2020-05-12 16:06:45 +04:00
in {
2020-02-17 17:00:59 +04:00
networking = {
networkmanager.enable = true;
firewall = {
enable = true;
2021-03-16 22:34:46 +04:00
allowedTCPPorts = [ 13748 13722 5000 22 80 443 51820 ];
2020-05-12 16:06:45 +04:00
interfaces.wlan0.allowedTCPPortRanges = localRanges;
interfaces.wlan0.allowedUDPPortRanges = localRanges;
interfaces.eth0.allowedUDPPortRanges = localRanges;
interfaces.eth0.allowedTCPPortRanges = localRanges;
2020-02-17 17:00:59 +04:00
};
resolvconf.extraConfig = ''
local_nameservers=""
name_server_blacklist="0.0.0.0 127.0.0.1"
resolv_conf_local_only=NO
'';
usePredictableInterfaceNames = false;
hostName = config.device;
};
2021-06-08 20:35:21 +04:00
persist.state.directories = [ "/etc/NetworkManager/system-connections" ];
2021-01-21 22:13:53 +04:00
networking.firewall.trustedInterfaces = [ "eth0" ];
2020-02-17 17:00:59 +04:00
systemd.services.ModemManager.wantedBy =
2020-05-20 19:41:56 +04:00
lib.optional (config.device == "T490s-Laptop") "network.target";
2021-03-16 22:34:46 +04:00
2020-02-17 17:00:59 +04:00
}