Forrest logo
back to the nixos-rebuild tool

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 test
try on your machine

The command sudo nixos-rebuild test is used to test the NixOS configuration without actually making any changes to the current system. It allows you to ensure that the configuration is correct and performs as expected before committing it to the system.

In more detail, here's what each part of the command means:

  • sudo: This is a command that allows you to execute another command as a superuser or root user. It is often required for administrative tasks like system configuration.

  • nixos-rebuild: This is a NixOS command that is used to build and activate a new system configuration. It essentially applies changes to the NixOS system based on the configuration files.

  • test: This is an argument or option provided to nixos-rebuild command. It tells the command to perform a test mode rebuild. In this mode, the new system configuration is built and tested, but the changes are not permanently applied to the system. It is useful for checking whether the new configuration is valid and works as expected without actually modifying the system.

Overall, sudo nixos-rebuild test is used to test the NixOS configuration temporarily without modifying the current system, allowing you to ensure that any changes you make will work correctly and not cause any issues before applying them permanently.

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