Forrest logo
back to the nixos-rebuild tool

nixos-rebuild:tldr:c92b7

nixos-rebuild: Build the configuration and open it in a virtual machine.
$ sudo nixos-rebuild build-vm
try on your machine

The sudo nixos-rebuild build-vm command is used to build a virtual machine (VM) image using the NixOS Linux distribution.

Here is a breakdown of the command:

  • sudo: This command runs the subsequent command as a superuser or root user. It prompts for the administrator password if required.

  • nixos-rebuild: This command is a utility provided by the NixOS distribution for managing system configurations. It is used to build, deploy, and switch between different system configurations.

  • build-vm: This is an argument to the nixos-rebuild command, specifying that you want to build a VM image.

By running sudo nixos-rebuild build-vm, you trigger the process of building a VM image using the current system configuration specified in your NixOS configuration file (/etc/nixos/configuration.nix). This command will download and install any required packages, settings, and services defined in the configuration file, resulting in a VM image that you can use with a virtualization platform such as VirtualBox or QEMU.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the nixos-rebuild tool