Forrest logo
back to the nixos-rebuild tool

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 machine

The command "sudo nixos-rebuild switch -p ${name}" is used in the NixOS operating system to rebuild and switch to a new system configuration profile.

  • "sudo": It is used to run the command as a superuser or with administrative privileges.
  • "nixos-rebuild": It is a command-line utility provided by NixOS for managing system configurations.
  • "switch": It is an argument to the "nixos-rebuild" command that tells it to switch to the new configuration.
  • "-p ${name}": It is an argument to the "nixos-rebuild" command that specifies the profile name to be used for the system configuration.

Depending on the value of the "${name}" variable, this command will rebuild and switch the system configuration to the specified profile. Profiles in NixOS are used to define different sets of packages, services, and configurations that can be easily switched between.

Note: The "${name}" in the command is a placeholder and should be replaced with the actual profile name you want to use.

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