Add bootloader recovery steps

This commit is contained in:
2025-12-19 17:08:55 -05:00
parent 8534a196a9
commit ae2149261e
2 changed files with 24 additions and 1 deletions

View File

@@ -64,3 +64,23 @@ To cleanup previous files, run nix garbage collection:
```sh
just clean
```
## Restoring from a live USB
If the bootloader for some reason breaks (i.e. motherboard firmware upgrade), restore it from a live USB by running the following commands:
```console
$ sudo cryptsetup luksOpen /dev/nvme0n1p2 crypted-nixos
Enter passphrase for /dev/nvme0n1p2: ********
$ sudo mount /dev/vg/root /mnt
$ sudo mount /dev/nvme0n1p1 /mnt/boot/efi
$ sudo mount /dev/vg/home /mnt/home
$ sudo nixos-enter /mnt
$ hostname <hostname>
```
Navigate to the nix-config directory and run:
```sh
just rebuild-boot
```

View File

@@ -8,7 +8,10 @@ arch := `uname -s`
cmd := if arch == "Linux" { "nixos-rebuild --sudo" } else { "darwin-rebuild" }
rebuild:
sudo $cmd switch --flake . -I nixos-config="hosts/$(hostname).nix" --show-trace
$cmd switch --flake .
rebuild-boot:
$cmd boot --flake . --install-bootloader
rollback:
sudo $cmd switch --rollback --flake .