summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/net.nix20
1 files changed, 15 insertions, 5 deletions
diff --git a/sys/net.nix b/sys/net.nix
index 4075a12..b441350 100644
--- a/sys/net.nix
+++ b/sys/net.nix
@@ -15,18 +15,28 @@ in
};
config = {
+ environment.systemPackages = [ pkgs.dhcpcd ];
+
networking = {
hostName = cfg.hostname;
+
useDHCP = false;
useNetworkd = true;
- interfaces = mkIf (cfg.dhcpInterface != null) {
- "${cfg.dhcpInterface}".useDHCP = true;
- };
-
wireguard.enable = true;
};
- environment.systemPackages = [ pkgs.dhcpcd ];
+ systemd.network.networks."40-${cfg.dhcpInterface}" = mkIf (cfg.dhcpInterface != null) {
+ matchConfig.Name = cfg.dhcpInterface;
+
+ networkConfig = {
+ DHCP = "ipv4";
+ IPv6AcceptRA = true;
+ IPv6PrivacyExtensions = "kernel";
+ };
+
+ # make routing on this interface a dependency for network-online.target
+ linkConfig.RequiredForOnline = "routable";
+ };
};
}