Skip to main content

Changing default user

In configuration.nix set the new username.

Apply the new configuration:

sudo nixos-rebuild boot

Exit the WSL shell and stop your NixOS distro from powershell:

wsl -t NixOS

Start a shell inside NixOS and immediately exit it to apply the new generation:

wsl -d NixOS --user root exit

Stop the distro again:

wsl -t NixOS

Open a WSL shell. Your new username should be applied now!