diff --git a/nixos/modules/services/networking/networkmanager.nix b/nixos/modules/services/networking/networkmanager.nix index caa7b0fffffd11..d2d49ee2eeb918 100644 --- a/nixos/modules/services/networking/networkmanager.nix +++ b/nixos/modules/services/networking/networkmanager.nix @@ -598,7 +598,7 @@ in ]; systemd.services.NetworkManager = { - wantedBy = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; restartTriggers = [ configFile ]; aliases = [ "dbus-org.freedesktop.NetworkManager.service" ]; @@ -614,7 +614,7 @@ in }; systemd.services.NetworkManager-dispatcher = { - wantedBy = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; restartTriggers = [ configFile overrideNameserversScript diff --git a/nixos/tests/networking/networkmanager.nix b/nixos/tests/networking/networkmanager.nix index bd989408df8a1d..23517a6cc47ecc 100644 --- a/nixos/tests/networking/networkmanager.nix +++ b/nixos/tests/networking/networkmanager.nix @@ -33,6 +33,17 @@ let }; } extraConfig; testCases = { + startup = { + name = "startup"; + nodes.client = { + networking.useDHCP = false; + networking.networkmanager.enable = true; + }; + testScript = '' + with subtest("NetworkManager is started automatically at boot"): + client.wait_for_unit("NetworkManager.service") + ''; + }; static = { name = "static"; nodes = {