1

Fix network wait-online by setting routable correctly

This commit is contained in:
2024-05-30 10:52:38 +02:00
parent ba07f1c216
commit aea3b8598c
4 changed files with 18 additions and 5 deletions

View File

@ -5,7 +5,7 @@
lib, lib,
... ...
}: rec { }: rec {
mkSystemdNetwork = interface: { mkSystemdNetwork = interface: routable: {
# name = "enp0s31f6"; # Network interface name? # name = "enp0s31f6"; # Network interface name?
enable = true; enable = true;
@ -30,7 +30,7 @@
linkConfig = { linkConfig = {
# This corresponds to the [LINK] section # This corresponds to the [LINK] section
# RequiredForOnline = "routable"; # RequiredForOnline = "routable";
RequiredForOnline = "no"; # Don't make nixos-rebuild wait for systemd-networkd-wait-online.service RequiredForOnline = if routable then "routable" else "no"; # Don't make nixos-rebuild wait for systemd-networkd-wait-online.service
}; };
}; };
@ -39,6 +39,7 @@
ip, ip,
router, router,
nameserver, nameserver,
routable,
}: { }: {
# name = "enp0s31f6"; # Network interface name? # name = "enp0s31f6"; # Network interface name?
enable = true; enable = true;
@ -75,7 +76,7 @@
linkConfig = { linkConfig = {
# This corresponds to the [LINK] section # This corresponds to the [LINK] section
# RequiredForOnline = "routable"; # RequiredForOnline = "routable";
RequiredForOnline = "no"; # Don't make nixos-rebuild wait for systemd-networkd-wait-online.service RequiredForOnline = if routable then "routable" else "no"; # Don't make nixos-rebuild wait for systemd-networkd-wait-online.service
}; };
}; };

View File

@ -30,7 +30,7 @@ with mylib.networking; {
networks = { networks = {
# Default wildcard ethernet network for all hosts # Default wildcard ethernet network for all hosts
"50-ether" = mkSystemdNetwork "enp*"; "50-ether" = mkSystemdNetwork "enp*" false;
}; };
allowedTCPPorts = [ allowedTCPPorts = [

View File

@ -23,7 +23,18 @@ in {
# Main Networks # Main Networks
systemd.network = { systemd.network = {
enable = true; enable = true;
wait-online.anyInterface = true; # Don't wait for all networks to be configured, as e.g. wg0 will only be upon manual activation wait-online.timeout = 10;
# Don't wait for all networks to be configured, as e.g. wg0 will only be upon manual activation
wait-online.anyInterface = true;
# TODO: Apparently anyInterface doesn't work?
# wait-online.ignoredInterfaces = [
# "wg0"
# "wlp7s0"
# "enp5s0"
# ];
networks = cfg.networks; networks = cfg.networks;
}; };

View File

@ -36,6 +36,7 @@
ip = ["192.168.86.50/24"]; ip = ["192.168.86.50/24"];
router = ["192.168.86.5"]; router = ["192.168.86.5"];
nameserver = ["192.168.86.26"]; nameserver = ["192.168.86.26"];
routable = true;
}; };
# "10-ether-1G" = mylib.networking.mkStaticSystemdNetwork {...}; # "10-ether-1G" = mylib.networking.mkStaticSystemdNetwork {...};
}; };