Rebuild Error - Failed to start Network Manager Wait Online

I’m getting an error massage, “Failed to start Network Manager Wait Online” whenever I try to do a rebuild switch or test. I’ve tried adding systemd.network.wait-online.enable = false, but still get the same error message. I’ve also tried reverting to an earlier version of my flake config, but I still get the same issue, so I feel like it has more to do with something I may have done to my system outside of my nixos rebuild/nixos configuration, though maybe I didn’t revert far enough.

My rebuild switch fails with the following message:

Job for NetworkManager-wait-online.service failed because the control process exited with error code.
See "systemctl status NetworkManager-wait-online.service" and "journalctl -xeu NetworkManager-wait-online.service" for details.
the following new units were started: nix-gc.timer, nix-optimise.timer, sysinit-reactivation.target, systemd-boot-random-seed.service, systemd-tmpfiles-resetup.service
warning: the following units failed: NetworkManager-wait-online.service

× NetworkManager-wait-online.service - Network Manager Wait Online
     Loaded: loaded (/etc/systemd/system/NetworkManager-wait-online.service; enabled; preset: enabled)
    Drop-In: /nix/store/rxxhydgmj6ps4bwird09306pjvh16bd4-system-units/NetworkManager-wait-online.service.d
             └─overrides.conf
     Active: failed (Result: exit-code) since Wed 2024-03-20 20:21:13 CDT; 49ms ago
   Duration: 1min 8.489s
       Docs: man:NetworkManager-wait-online.service(8)
    Process: 5569 ExecStart=/nix/store/9prndc4rizidz1igbsp2lwrsrx733j99-networkmanager-1.44.2/bin/nm-online -s -q (code=exited, status=1/FAILURE)
   Main PID: 5569 (code=exited, status=1/FAILURE)
         IP: 0B in, 0B out
        CPU: 30ms

Mar 20 20:20:13 nixos systemd[1]: Starting Network Manager Wait Online...
Mar 20 20:21:13 nixos systemd[1]: NetworkManager-wait-online.service: Main process exited, code=exited, status=1/FAILURE
Mar 20 20:21:13 nixos systemd[1]: NetworkManager-wait-online.service: Failed with result 'exit-code'.
Mar 20 20:21:13 nixos systemd[1]: Failed to start Network Manager Wait Online.

Here is the output to the journalctl command:

The output of the systemctl command is the same as the error message in the switch output.

Here is my flake: GitHub - dcolestock/nixos-flake

Any ideas what I’m doing wrong to cause this error?

I eventually solved this by adding

systemd.network.wait-online.enable = false;
boot.initrd.systemd.network.wait-online.enable = false;

To my config, switching, rebooting (where I didn’t have any internet), then removing them from my config, switching and rebooting. Not sure which of those steps were required, for all I know it was just the couple of reboots that did it.