diff options
author | Maximilian Bosch <maximilian@mbosch.me> | 2022-04-29 13:48:01 +0200 |
---|---|---|
committer | Maximilian Bosch <maximilian@mbosch.me> | 2022-04-30 00:30:03 +0200 |
commit | aa849e14785930404601747c7ea7b6172d80832d (patch) | |
tree | c4f248c0c7f5ca549e72302af83248fea5a8fbca /nixos/modules/tasks/network-interfaces-systemd.nix | |
parent | 161dd27ee1ac84a78bda62a603dcb54ae1f8b15f (diff) | |
download | nixpkgs-aa849e14785930404601747c7ea7b6172d80832d.tar nixpkgs-aa849e14785930404601747c7ea7b6172d80832d.tar.gz nixpkgs-aa849e14785930404601747c7ea7b6172d80832d.tar.bz2 nixpkgs-aa849e14785930404601747c7ea7b6172d80832d.tar.lz nixpkgs-aa849e14785930404601747c7ea7b6172d80832d.tar.xz nixpkgs-aa849e14785930404601747c7ea7b6172d80832d.tar.zst nixpkgs-aa849e14785930404601747c7ea7b6172d80832d.zip |
nixos/network-interfaces-systemd: actually set catchall-iface if `useDHCP = true;`
Previously this wasn't done in the `forEach`-expression for `cfg.interfaces` and thus `networking.useDHCP` didn't have any effect if no further interface was statically configured.
Diffstat (limited to 'nixos/modules/tasks/network-interfaces-systemd.nix')
-rw-r--r-- | nixos/modules/tasks/network-interfaces-systemd.nix | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/nixos/modules/tasks/network-interfaces-systemd.nix b/nixos/modules/tasks/network-interfaces-systemd.nix index 4273bbc6f0c..110e84494a3 100644 --- a/nixos/modules/tasks/network-interfaces-systemd.nix +++ b/nixos/modules/tasks/network-interfaces-systemd.nix @@ -74,18 +74,7 @@ in in mkMerge [ { enable = true; } - (mkMerge (forEach interfaces (i: { - netdevs = mkIf i.virtual ({ - "40-${i.name}" = { - netdevConfig = { - Name = i.name; - Kind = i.virtualType; - }; - "${i.virtualType}Config" = optionalAttrs (i.virtualOwner != null) { - User = i.virtualOwner; - }; - }; - }); + (mkIf cfg.useDHCP { networks."99-ethernet-default-dhcp" = lib.mkIf cfg.useDHCP { # We want to match physical ethernet interfaces as commonly # found on laptops, desktops and servers, to provide an @@ -120,6 +109,19 @@ in dhcpV4Config.RouteMetric = 1025; ipv6AcceptRAConfig.RouteMetric = 1025; }; + }) + (mkMerge (forEach interfaces (i: { + netdevs = mkIf i.virtual ({ + "40-${i.name}" = { + netdevConfig = { + Name = i.name; + Kind = i.virtualType; + }; + "${i.virtualType}Config" = optionalAttrs (i.virtualOwner != null) { + User = i.virtualOwner; + }; + }; + }); networks."40-${i.name}" = mkMerge [ (genericNetwork id) { name = mkDefault i.name; DHCP = mkForce (dhcpStr |