I am testing something out*, and I want to make sure the newly built configuration is sane before even trying to switch to it. I started by running
sudo nixos-rebuild build and verifying that it returned exit code 0. But now I can’t find the result - I expected that command to create a new generation, but
sudo nix-env --list-generations doesn’t show it. So where do I find the build results, how do I verify which packages it contains, and how do I switch to it without building again?
* It’s probably not relevant, but I’ve split my configuration.nix into common and machine-specific files, and I want to make sure that multiple
environment.systemPackages instances are merged rather than overridden.
The derivation will be accessible via the ./result symlink created in you current directory by
nixos-rebuild test is what you’re looking for:
Build and activate the new configuration, but do not add it to the
GRUB boot menu. Thus, if you reboot the system (or if it crashes),
you will automatically revert to the default configuration (i.e.
the configuration resulting from the last call to nixos-rebuild
switch or nixos-rebuild boot).
You can also call
./result/bin/switch-to-configuration to test it out I think if you used
nixos-rebuild boot instead
Too bad I can’t mark both replies as solutions
find result/sw/ was the final piece of the puzzle. Looks like
environment.systemPackages is merged somehow.