![Forrest logo](/images/logo.png)
nixos-rebuild
NixOS-rebuild is a command-line tool in NixOS, a Linux distribution built around the Nix package manager. It allows users to build and manage the system configuration of NixOS. The tool is used to deploy changes to the system configuration, applying updates and modifications. It operates by taking a "system declaration" file, written in the Nix Expression Language, which specifies all the packages, services, and system settings to be installed or changed. NixOS-rebuild then builds the system configuration according to the declaration and activates it. The tool enables users to switch between different system configurations, making it easy to roll back to previous configurations if necessary. It ensures consistent and reproducible deployments, with changes being applied atomically. Overall, NixOS-rebuild provides a powerful and flexible way to manage and update the system configuration of NixOS.
List of commands for nixos-rebuild:
-
nixos-rebuild:tldr:0a5ff nixos-rebuild: Build and switch to the new configuration, making it the boot default and installing updates.$ sudo nixos-rebuild switch --upgradetry on your machineexplain this command
-
nixos-rebuild:tldr:2b0fb nixos-rebuild: Build and switch to the new configuration, making it the boot default.$ sudo nixos-rebuild switchtry on your machineexplain this command
-
nixos-rebuild:tldr:68846 nixos-rebuild: Build the new configuration and make it the boot default without switching to it.$ sudo nixos-rebuild boottry on your machineexplain this command
-
nixos-rebuild:tldr:8fc96 nixos-rebuild: Build and activate the new configuration, but don't make a boot entry (for testing purposes).$ sudo nixos-rebuild testtry on your machineexplain this command
-
nixos-rebuild:tldr:c92b7 nixos-rebuild: Build the configuration and open it in a virtual machine.$ sudo nixos-rebuild build-vmtry on your machineexplain this command
-
nixos-rebuild:tldr:e72bb nixos-rebuild: Rollback changes to the configuration, switching to the previous generation.$ sudo nixos-rebuild switch --rollbacktry on your machineexplain this command
-
nixos-rebuild:tldr:efef2 nixos-rebuild: Build and switch to the new configuration, making it the boot default and naming the boot entry.$ sudo nixos-rebuild switch -p ${name}try on your machineexplain this command