Skip to content

Instantly share code, notes, and snippets.

@CMCDragonkai
Created December 13, 2018 01:25
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CMCDragonkai/6237ff7fe960f971bb03c9fe6ddd8a7c to your computer and use it in GitHub Desktop.
Save CMCDragonkai/6237ff7fe960f971bb03c9fe6ddd8a7c to your computer and use it in GitHub Desktop.
NixOS Recovery #nix

NixOS Recovery

Usually if you screw up the configuration.nix you can rollback to a previous generation during boot.

Then you use https://nixos.org/nixos/manual/#sec-rollback to fix the rollback generation.

However if you really screw it up, and none of the generations work, you may need use a recovery method.

Get a NixOS ISO (it's best to get one that has a same or similar version as your current one).

Boot into the NixOS ISO. Then once you're booted. You need to setup the root filesystem. In most cases, you only need:

/mnt
/mnt/boot
/mnt/tmp

Then you can use nixos-install which will do a nixos-rebuild but targetting /mnt.

You may not need /mnt/boot if you are not also rebuilding any of the boot directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment