From 1ef7d63228898f5b04019b8f3883f4d2f58f81cf Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Sun, 29 Jun 2025 20:25:42 +0200 Subject: [PATCH] nixos/installer: ship the minimal ISO with networkmanager With networkmanager we can provide a much more welcoming network setup experience in the installer and it costs us less than 10 MB with this configuration on the minimal ISO. By default, for new profiles it will enable DHCP and RA and allow interactive reconfiguration through `nmtui` or `nmcli`. Especially the TUI interface is very easy to pick up and removes the need for typing in manual commands when setting up the WLAN connection. --- .../profiles/installation-device.section.md | 4 +- .../manual/installation/installing.chapter.md | 49 ++----------------- .../cd-dvd/installation-cd-graphical-base.nix | 4 -- .../installer/netboot/netboot-minimal.nix | 2 +- .../modules/profiles/installation-device.nix | 10 ++-- 5 files changed, 10 insertions(+), 59 deletions(-) diff --git a/nixos/doc/manual/configuration/profiles/installation-device.section.md b/nixos/doc/manual/configuration/profiles/installation-device.section.md index ae9f8fa7757f..7d8082e27557 100644 --- a/nixos/doc/manual/configuration/profiles/installation-device.section.md +++ b/nixos/doc/manual/configuration/profiles/installation-device.section.md @@ -14,8 +14,8 @@ NixOS manual is shown automatically on TTY 8, udisks is disabled. Autologin is enabled as `nixos` user, while passwordless login as both `root` and `nixos` is possible. Passwordless `sudo` is enabled too. -[wpa_supplicant](#opt-networking.wireless.enable) is -enabled, but configured to not autostart. +[NetworkManager](#opt-networking.networkmanager.enable) is +enabled and can be configured interactively with `nmtui`. It is explained how to login, start the ssh server, and if available, how to start the display manager. diff --git a/nixos/doc/manual/installation/installing.chapter.md b/nixos/doc/manual/installation/installing.chapter.md index 8ee417a108fd..4ae8bf494848 100644 --- a/nixos/doc/manual/installation/installing.chapter.md +++ b/nixos/doc/manual/installation/installing.chapter.md @@ -154,54 +154,13 @@ The boot process should have brought up networking (check `ip a`). Networking is necessary for the installer, since it will download lots of stuff (such as source tarballs or Nixpkgs channel binaries). It's best if you have a DHCP server on your network. -Otherwise configure networking manually using `ifconfig`. +Otherwise configure networking manually using `ip`. -On the graphical installer, you can configure the network, wifi -included, through NetworkManager. Using the `nmtui` program, you can do -so even in a non-graphical session. If you prefer to configure the -network manually, disable NetworkManager with +You can configure the network, Wi-Fi included, through NetworkManager. +Using the `nmtui` program, you can do so even in a non-graphical session. + If you prefer to configure the network manually, disable NetworkManager with `systemctl stop NetworkManager`. -On the minimal installer, NetworkManager is not available, so -configuration must be performed manually. To configure the wifi, first -start wpa_supplicant with `sudo systemctl start wpa_supplicant`, then -run `wpa_cli`. For most home networks, you need to type in the following -commands: - -```plain -> add_network -0 -> set_network 0 ssid "myhomenetwork" -OK -> set_network 0 psk "mypassword" -OK -> enable_network 0 -OK -``` - -For enterprise networks, for example *eduroam*, instead do: - -```plain -> add_network -0 -> set_network 0 ssid "eduroam" -OK -> set_network 0 identity "myname@example.com" -OK -> set_network 0 password "mypassword" -OK -> enable_network 0 -OK -``` - -When successfully connected, you should see a line such as this one - -```plain -<3>CTRL-EVENT-CONNECTED - Connection to 32:85:ab:ef:24:5c completed [id=0 id_str=] -``` - -you can now leave `wpa_cli` by typing `quit`. - If you would like to continue the installation from a different machine you can use activated SSH daemon. You need to copy your ssh key to either `/home/nixos/.ssh/authorized_keys` or diff --git a/nixos/modules/installer/cd-dvd/installation-cd-graphical-base.nix b/nixos/modules/installer/cd-dvd/installation-cd-graphical-base.nix index f73617694961..37998c334e5f 100644 --- a/nixos/modules/installer/cd-dvd/installation-cd-graphical-base.nix +++ b/nixos/modules/installer/cd-dvd/installation-cd-graphical-base.nix @@ -20,10 +20,6 @@ services.xserver.enable = true; - # Provide networkmanager for easy wireless configuration. - networking.networkmanager.enable = true; - networking.wireless.enable = lib.mkImageMediaOverride false; - # KDE complains if power management is disabled (to be precise, if # there is no power management backend such as upower). powerManagement.enable = true; diff --git a/nixos/modules/installer/netboot/netboot-minimal.nix b/nixos/modules/installer/netboot/netboot-minimal.nix index dc881a336997..59f5fb757c3b 100644 --- a/nixos/modules/installer/netboot/netboot-minimal.nix +++ b/nixos/modules/installer/netboot/netboot-minimal.nix @@ -11,5 +11,5 @@ documentation.man.enable = lib.mkOverride 500 true; hardware.enableRedistributableFirmware = lib.mkOverride 70 false; system.extraDependencies = lib.mkOverride 70 [ ]; - networking.wireless.enable = lib.mkOverride 500 false; + networking.networkmanager.enable = lib.mkOverride 500 false; } diff --git a/nixos/modules/profiles/installation-device.nix b/nixos/modules/profiles/installation-device.nix index 3a29f7ab8c90..375cfc7087d7 100644 --- a/nixos/modules/profiles/installation-device.nix +++ b/nixos/modules/profiles/installation-device.nix @@ -69,9 +69,7 @@ with lib; with `passwd` (prefix with `sudo` for "root"), or add your public key to /home/nixos/.ssh/authorized_keys or /root/.ssh/authorized_keys. - If you need a wireless connection, type - `sudo systemctl start wpa_supplicant` and configure a - network using `wpa_cli`. See the NixOS manual for details. + To set up a wireless connection, run `nmtui`. '' + optionalString config.services.xserver.enable '' @@ -89,10 +87,8 @@ with lib; settings.PermitRootLogin = mkDefault "yes"; }; - # Enable wpa_supplicant, but don't start it by default. - networking.wireless.enable = mkDefault true; - networking.wireless.userControlled.enable = true; - systemd.services.wpa_supplicant.wantedBy = mkOverride 50 [ ]; + # Provide networkmanager for easy network configuration. + networking.networkmanager.enable = true; # Tell the Nix evaluator to garbage collect more aggressively. # This is desirable in memory-constrained environments that don't