NixOS Commands
nixos-enter,nixos-generate-config, andnixos-installall accept a--root <path>argument to change the path to the NixOS installation. By default,nixos-generate-configacts on/, and the others act on/mnt.
nixos-enter
Chroots into a NixOS installation.
Without a command, enters an interactive shell.
{--command | -c} <cmd>executes a command in the shell,-- <args...>executes a command not in the shell.
nixos-generate-config
Generates configuration.nix if it doesn't already exist, and generates or
updates hardware-configuration.nix.
nixos-install
Installs NixOS from an existing configuration.nix.
--no-root-passwddo not ask for a root password. Disables root login unless otherwise specified inconfiguration.nix.
nixos-option
Lists the properties of the specified option.
nixos-rebuild
Builds a system from the current configuration.
The following need root:
bootbuilds the new configuration and makes it the default boot target,testbuilds the new configuration and modifies the currently running system to match it,switchbuilds the new configuration, makes it the default boot target, and modifies the currently running system to match it.
While the following can be run as non-root:
buildbuilds the new configuration and makes a symlinkresult,dry-buildshows what would be performed bybuildorbootbut otherwise does nothing,dry-activateshows what would be performed bytestorswitchbut otherwise does nothing,build-vmbuilds the new configuration and makes a symlinkresult, with a scriptresult/bin/run-<hostname>-vmwhich runs a qemu virtual machine for the resulting system,build-vm-with-bootloaderdoes the same asbuild-vmbut for testing purposes uses the normal configured bootloader inside the virtual machine.
see also NixOS Manual: Chapter 3. Changing the Configuration
nixos-version
Prints the version.