Forrest logo
back to the nixos-rebuild tool

nixos-rebuild:tldr:68846

nixos-rebuild: Build the new configuration and make it the boot default without switching to it.
$ sudo nixos-rebuild boot
try on your machine

The command "sudo nixos-rebuild boot" is used in NixOS to build a new configuration and activate it on the next system boot.

Here's a breakdown of the command:

  • "sudo": This keyword is used to run the subsequent command with administrative privileges. It allows you to make system-wide changes that require elevated access.

  • "nixos-rebuild": This is the command-line tool provided by NixOS to manage system configuration. It is used to build and activate a new configuration.

  • "boot": This command is a specific subcommand of "nixos-rebuild." When "boot" is specified, it means that the new configuration will take effect on the next system boot.

Using "sudo nixos-rebuild boot" triggers NixOS to rebuild the configuration defined in the "/etc/nixos/configuration.nix" file, activating the changes after the next system restart. This command is commonly used after making changes to the NixOS configuration file to apply those changes and update the system accordingly.

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