summary refs log tree commit diff
path: root/nixos/modules/tasks
diff options
context:
space:
mode:
authorNaïm Favier <n@monade.li>2022-06-17 19:16:39 +0200
committerNaïm Favier <n@monade.li>2022-06-21 17:12:01 +0200
commitf8a83b426000494c9b2fee5532f6b98beeeb8743 (patch)
treec295b7aeb10e26e72dafca46676da53a802d2bc7 /nixos/modules/tasks
parente7f161a3e89c74f3a9c6302795cd7bbc67f12a84 (diff)
downloadnixpkgs-f8a83b426000494c9b2fee5532f6b98beeeb8743.tar
nixpkgs-f8a83b426000494c9b2fee5532f6b98beeeb8743.tar.gz
nixpkgs-f8a83b426000494c9b2fee5532f6b98beeeb8743.tar.bz2
nixpkgs-f8a83b426000494c9b2fee5532f6b98beeeb8743.tar.lz
nixpkgs-f8a83b426000494c9b2fee5532f6b98beeeb8743.tar.xz
nixpkgs-f8a83b426000494c9b2fee5532f6b98beeeb8743.tar.zst
nixpkgs-f8a83b426000494c9b2fee5532f6b98beeeb8743.zip
nixos/networkd: make default networks `RequiredForOnline` when possible
When `systemd.network.wait-online.anyInterface` is enabled,
`RequiredForOnline` really means "sufficient for online", so enable it.
Diffstat (limited to 'nixos/modules/tasks')
-rw-r--r--nixos/modules/tasks/network-interfaces-systemd.nix14
1 files changed, 7 insertions, 7 deletions
diff --git a/nixos/modules/tasks/network-interfaces-systemd.nix b/nixos/modules/tasks/network-interfaces-systemd.nix
index 069116ff0a6..65cd52a35cd 100644
--- a/nixos/modules/tasks/network-interfaces-systemd.nix
+++ b/nixos/modules/tasks/network-interfaces-systemd.nix
@@ -88,20 +88,20 @@ in
           # more likely to result in interfaces being configured to
           # use DHCP when they shouldn't.
 
-          # We set RequiredForOnline to false, because it's fairly
-          # common for such devices to have multiple interfaces and
-          # only one of them to be connected (e.g. a laptop with
-          # ethernet and WiFi interfaces). Maybe one day networkd will
-          # support "any"-style RequiredForOnline...
+          # When wait-online.anyInterface is enabled, RequiredForOnline really
+          # means "sufficient for online", so we can enable it.
+          # Otherwise, don't block the network coming online because of default networks.
           matchConfig.Name = ["en*" "eth*"];
           DHCP = "yes";
-          linkConfig.RequiredForOnline = lib.mkDefault false;
+          linkConfig.RequiredForOnline =
+            lib.mkDefault config.systemd.network.wait-online.anyInterface;
         };
         networks."99-wireless-client-dhcp" = lib.mkIf cfg.useDHCP {
           # Like above, but this is much more likely to be correct.
           matchConfig.WLANInterfaceType = "station";
           DHCP = "yes";
-          linkConfig.RequiredForOnline = lib.mkDefault false;
+          linkConfig.RequiredForOnline =
+            lib.mkDefault config.systemd.network.wait-online.anyInterface;
           # We also set the route metric to one more than the default
           # of 1024, so that Ethernet is preferred if both are
           # available.