diff --git a/modules/config/networking.nix b/modules/config/networking.nix
index 8343912d830..4349b52347a 100644
--- a/modules/config/networking.nix
+++ b/modules/config/networking.nix
@@ -51,7 +51,7 @@ in
           ''
             ${cfg.extraHosts}
             ${optionalString (cfg.hostName != "")
-              "127.0.0.1 ${cfg.hostName} ${hostnameWithDomain}"}
+              "127.0.0.1 ${hostnameWithDomain} ${cfg.hostName}"}
             127.0.0.1 localhost ${localhostWithDomain}
           '';
         target = "hosts";