Recuperarse de `nixos-rebuild test` sin reiniciar

Pregunta:

¿Hay alguna forma de volver a la configuración anterior (o al menos "actual") después nixos-rebuild test sin reiniciar?

Según el nixos-rebuild :

   test
       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).

Claramente, reiniciar debería devolverme a un sistema que funcione, pero parece que no debería ser necesario.

La opción --rollback parece prometedora:

   --rollback
       Instead of building a new configuration as specified
       by /etc/nixos/configuration.nix, roll back to the
       previous configuration. (The previous configuration
       is defined as the one before the “current”
       generation of the Nix profile /nix/var/nix/profiles/
       system.)

Excepto que quiero activar la generación "actual", no la generación anterior.

Por ejemplo. La generación 18 es la "actual", que está un poco desactualizada pero es aceptable. La generación 17 es mayor. nixos-rebuild test --upgrade que rompió Chrome, así que quiero volver a 18 sin reiniciar. (Hasta que pueda resolver los problemas de actualización).

Actualización: probé nixos-rebuild test --rollback , pero la documentación es precisa: volvió a 17 en lugar de 18.

Respuesta:

Al leer la fuente, encontré esta solución que parece haber funcionado, pero se siente realmente extraña:

# /nix/var/nix/profiles/system-18-link/bin/switch-to-configuration test
activating the configuration...
setting up /etc...
setting up tmpfiles
reloading the following units: dbus.service

¿Hay una forma más limpia?

Leave a Comment

Your email address will not be published. Required fields are marked *

web tasarım