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.
This commit is contained in:
Martin Weinelt 2025-06-29 20:25:42 +02:00
parent 67c6a0c938
commit 1ef7d63228
No known key found for this signature in database
GPG Key ID: 87C1E9888F856759
5 changed files with 10 additions and 59 deletions

View File

@ -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.

View File

@ -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

View File

@ -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;

View File

@ -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;
}

View File

@ -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