Merge pull request #258345 from lf-/jade/wait-for-online

nixos/networkd: fix wait-online on networking.useDHCP default configuration
This commit is contained in:
Florian Klink 2023-10-04 10:58:14 +03:00 committed by GitHub
commit d89aa11c89
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 10 deletions

View file

@ -93,6 +93,9 @@
## Backward Incompatibilities {#sec-release-23.11-incompatibilities} ## Backward Incompatibilities {#sec-release-23.11-incompatibilities}
- `network-online.target` has been fixed to no longer time out for systems with `networking.useDHCP = true` and `networking.useNetworkd = true`.
Workarounds for this can be removed.
- The `boot.loader.raspberryPi` options have been marked deprecated, with intent for removal for NixOS 24.11. They had a limited use-case, and do not work like people expect. They required either very old installs ([before mid-2019](https://github.com/NixOS/nixpkgs/pull/62462)) or customized builds out of scope of the standard and generic AArch64 support. That option set never supported the Raspberry Pi 4 family of devices. - The `boot.loader.raspberryPi` options have been marked deprecated, with intent for removal for NixOS 24.11. They had a limited use-case, and do not work like people expect. They required either very old installs ([before mid-2019](https://github.com/NixOS/nixpkgs/pull/62462)) or customized builds out of scope of the standard and generic AArch64 support. That option set never supported the Raspberry Pi 4 family of devices.
- `python3.pkgs.sequoia` was removed in favor of `python3.pkgs.pysequoia`. The latter package is based on upstream's dedicated repository for sequoia's Python bindings, where the Python bindings from [gitlab:sequoia-pgp/sequoia](https://gitlab.com/sequoia-pgp/sequoia) were removed long ago. - `python3.pkgs.sequoia` was removed in favor of `python3.pkgs.pysequoia`. The latter package is based on upstream's dedicated repository for sequoia's Python bindings, where the Python bindings from [gitlab:sequoia-pgp/sequoia](https://gitlab.com/sequoia-pgp/sequoia) were removed long ago.

View file

@ -2724,9 +2724,12 @@ let
description = lib.mdDoc '' description = lib.mdDoc ''
Whether to consider the network online when any interface is online, as opposed to all of them. Whether to consider the network online when any interface is online, as opposed to all of them.
This is useful on portable machines with a wired and a wireless interface, for example. This is useful on portable machines with a wired and a wireless interface, for example.
This is on by default if {option}`networking.useDHCP` is enabled.
''; '';
type = types.bool; type = types.bool;
default = false; defaultText = "config.networking.useDHCP";
default = config.networking.useDHCP;
}; };
ignoredInterfaces = mkOption { ignoredInterfaces = mkOption {

View file

@ -59,23 +59,14 @@ let
# more likely to result in interfaces being configured to # more likely to result in interfaces being configured to
# use DHCP when they shouldn't. # use DHCP when they shouldn't.
# 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*"]; matchConfig.Name = ["en*" "eth*"];
DHCP = "yes"; DHCP = "yes";
linkConfig.RequiredForOnline =
lib.mkDefault (if initrd
then config.boot.initrd.systemd.network.wait-online.anyInterface
else config.systemd.network.wait-online.anyInterface);
networkConfig.IPv6PrivacyExtensions = "kernel"; networkConfig.IPv6PrivacyExtensions = "kernel";
}; };
networks."99-wireless-client-dhcp" = { networks."99-wireless-client-dhcp" = {
# Like above, but this is much more likely to be correct. # Like above, but this is much more likely to be correct.
matchConfig.WLANInterfaceType = "station"; matchConfig.WLANInterfaceType = "station";
DHCP = "yes"; DHCP = "yes";
linkConfig.RequiredForOnline =
lib.mkDefault config.systemd.network.wait-online.anyInterface;
networkConfig.IPv6PrivacyExtensions = "kernel"; networkConfig.IPv6PrivacyExtensions = "kernel";
# We also set the route metric to one more than the default # We also set the route metric to one more than the default
# of 1024, so that Ethernet is preferred if both are # of 1024, so that Ethernet is preferred if both are