Files
LogSeq/pages/Tech/NixOS/Recover from `nixos-rebuild test` without a reboot.md
2025-12-11 06:26:12 -08:00

942 B

created:: 2024-01-26T15:43:17 (UTC -05:00) tags:: nixos source:: https://serverfault.com/questions/890886/recover-from-nixos-rebuild-test-without-a-reboot author:: aij 20311 silver badge77 bronze badges

  • Recover from nixos-rebuild test without a reboot - Server Fault

    Excerpt

    Is there a way to revert to the previous (or at least "current") configuration after nixos-rebuild test without rebooting?

    Per the nixos-rebuild manual:

    test Build and activate the new


    # List previous generations
    sudo nix-env --list-generations -p /nix/var/nix/profiles/system
    
    # Live switch to any generation
    sudo nix-env --switch-generation 12345 -p /nix/var/nix/profiles/system
    sudo /nix/var/nix/profiles/system/bin/switch-to-configuration switch
    

    Source: https://github.com/NixOS/nixpkgs/issues/24374