Oh wow, it seems that fixes it for me also…
I ran systemctl list-dependencies NetworkManager-wait-online.service --all --reverse to see what services were dependent on NetworkManager-wait-online and I was presented with the following result:
NetworkManager-wait-online.service
● └─network-online.target
● └─multi-user.target
● └─graphical.target
Then I search why multi-user.target depends on network-online.target and I found this immediately:
in nixos/modules/system/boot/systemd.nix we have
systemd.targets.network-online.wantedBy = [ "multi-user.target" ];
Why is that necessary? Seems strange, and slows down my boot by ~3s (when I’m in reach of a known network; longer otherwise)
And it seems to still be the issue on nixos-24.05:
restartIfChanged = false;
path = [ pkgs.util-linux ];
overrideStrategy = "asDropin";
};
systemd.services.systemd-random-seed.restartIfChanged = false;
systemd.services.systemd-remount-fs.restartIfChanged = false;
systemd.services.systemd-update-utmp.restartIfChanged = false;
systemd.services.systemd-udev-settle.restartIfChanged = false; # Causes long delays in nixos-rebuild
systemd.targets.local-fs.unitConfig.X-StopOnReconfiguration = true;
systemd.targets.remote-fs.unitConfig.X-StopOnReconfiguration = true;
systemd.targets.network-online.wantedBy = [ "multi-user.target" ];
systemd.services.systemd-importd.environment = proxy_env;
systemd.services.systemd-pstore.wantedBy = [ "sysinit.target" ]; # see #81138
# NixOS has kernel modules in a different location, so override that here.
systemd.services.kmod-static-nodes.unitConfig.ConditionFileNotEmpty = [
"" # required to unset the previous value!
"/run/booted-system/kernel-modules/lib/modules/%v/modules.devname"
];
# Don't bother with certain units in containers.
I’ll make a bug report in a next day or two, this is obviously not a normal behavior…