NixOS Commands
nixos-enter
,nixos-generate-config
, andnixos-install
all accept a--root <path>
argument to change the path to the NixOS installation. By default,nixos-generate-config
acts 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-passwd
do 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:
boot
builds the new configuration and makes it the default boot target,test
builds the new configuration and modifies the currently running system to match it,switch
builds 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:
build
builds the new configuration and makes a symlinkresult
,dry-build
shows what would be performed bybuild
orboot
but otherwise does nothing,dry-activate
shows what would be performed bytest
orswitch
but otherwise does nothing,build-vm
builds the new configuration and makes a symlinkresult
, with a scriptresult/bin/run-<hostname>-vm
which runs a qemu virtual machine for the resulting system,build-vm-with-bootloader
does the same asbuild-vm
but 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.