dot

vizie's NixOS desktop: Hyprland, CachyOS kernel and gaming tweaks

695c973

Mount the backup drive read-only; fix the after-reboot steps

By Gustaf Granström

NixOS mounts the Kingston backup drive at /mnt/backup (read-only, nofail),
so restore-from-sata and copying things back need no manual mount. Step 3
ran into a missing /mnt on the fresh system; it now runs the restore from
/mnt/backup. MIGRATION.md also covers the desktop coming back on a new IP
address and installing with the kernel built on CachyOS when the compile
runs out of RAM in the installer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

3 files changed +46 −20

modifiedMIGRATION.md
@@ -55,16 +55,31 @@
5555 gives 200), leave the flag out and the kernel downloads instead. The desktop
5656 reboots into NixOS at the end.
5757
58+If the kernel compile fails with a "Bus error", the installer ran out of RAM
59+(it builds there). The backup drive has the system that was built on CachyOS,
60+kernel included. Load it into the new system's store and run only the install:
61+
62+```bash
63+ssh root@10.0.0.40 'mkdir -p /backup && mount -o ro /dev/disk/by-label/backup /backup &&
64+ nix --extra-experimental-features nix-command copy --no-check-sigs \
65+ --from file:///backup/nix-cache --to /mnt "$(cat /backup/nix-cache/system)"'
66+nixos-anywhere --flake .#desktop --build-on remote --copy-host-keys --no-use-machine-substituters --phases install,reboot root@10.0.0.40
67+```
68+
5869 ## 3. After the reboot
5970
60-From the Mac (its key is in the config, for root and for you):
71+The desktop may come back on a different IP address (it did: 10.0.0.127). If
72+`ssh` times out, find it in the router's client list, or scan for the
73+desktop's host key: `ssh-keyscan -t ed25519 10.0.0.<n>` and compare with
74+`ssh-keygen -F 10.0.0.40`. A DHCP reservation in the router keeps it fixed.
6175
76+From the Mac (its key is in the config, for root and for you). The backup
77+drive is mounted read-only at `/mnt/backup`:
78+
6279 ```bash
63-ssh root@10.0.0.40
80+ssh root@10.0.0.127
6481 passwd vizie
65-mount -o ro /dev/disk/by-label/backup /mnt
66-/mnt/vizie/git/dot/tools/restore-from-sata
67-umount /mnt
82+/mnt/backup/vizie/git/dot/tools/restore-from-sata
6883 ```
6984
7085 Then log in on the desktop.
@@ -74,9 +89,8 @@
7489 - The login screen is the same gtkgreet over the blurred wallpaper.
7590 - Only what `restore-filter` lists came back: app data and logins, SSH keys,
7691 shell history, `~/git/dot`, Steam's settings and saves. Everything else
77- (Downloads, the other repos, CachyOS leftovers) is on the backup drive under
78- `vizie/`: `sudo mount -o ro /dev/disk/by-label/backup /mnt` to copy something
79- back.
92+ (Downloads, the other repos, CachyOS leftovers) is on the backup drive, at
93+ `/mnt/backup/vizie/`, to copy something back.
8094 - "Command not found" suggestions need nix-index's database once:
8195 `nix-index` (takes a few minutes).
8296 - Check the background programs: `systemctl --user list-units --type=service`.
@@ -131,9 +145,7 @@
131145 copy your settings and addons back before you start it:
132146
133147 ```bash
134- sudo mount -o ro /dev/disk/by-label/backup /mnt
135- cp -a /mnt/wow/{WTF,Interface} ~/Games/battlenet/drive_c/'Program Files (x86)'/'World of Warcraft'/_retail_/
136- sudo umount /mnt
148+ cp -a /mnt/backup/wow/{WTF,Interface} ~/Games/battlenet/drive_c/'Program Files (x86)'/'World of Warcraft'/_retail_/
137149 ```
138150
139151 - **OSRS**: install the official Old School RuneScape launcher. Bolt is gone,
@@ -141,8 +153,9 @@
141153
142154 ## 7. Once you're happy
143155
144-The backup on `sda` stays until you need the drive for something else. It is
145-the only copy of what wasn't restored, including the repos that exist only
146-here (`skate3`, `skate-game`, `he60`, `move`, and `Left4Resi`'s uncommitted
147-changes), so copy out anything you want before reusing the drive. NixOS
148-doesn't mount it; `sudo mount /dev/disk/by-label/backup /mnt` gets you into it.
156+The backup on the Kingston drive stays until you need the drive for something
157+else. It is the only copy of what wasn't restored, including the repos that
158+exist only here (`skate3`, `skate-game`, `he60`, `move`, and `Left4Resi`'s
159+uncommitted changes), so copy out anything you want before reusing the drive.
160+NixOS mounts it read-only at `/mnt/backup`; before reusing it, remove the
161+`fileSystems."/mnt/backup"` entry in `hosts/desktop/hardware-configuration.nix`.
@@ -3,7 +3,7 @@
33 # nixos-generate-config --show-hardware-config --root /mnt
44 # and keep the generated one if they differ.
55 #
6-# The file systems aren't here: disko.nix defines the drive's layout, and
6+# The NVMe drive's file systems aren't here: disko.nix defines its layout, and
77 # disko turns it into fileSystems entries.
88 {
99 config,
@@ -24,6 +24,20 @@
2424 ];
2525 boot.kernelModules = [ "kvm-amd" ];
2626
27+ # The Kingston SATA SSD with the CachyOS backup (tools/backup-to-sata),
28+ # read-only so nothing on it changes by accident. nofail: the system still
29+ # boots once the drive is gone or reused.
30+ fileSystems."/mnt/backup" = {
31+ device = "/dev/disk/by-label/backup";
32+ fsType = "btrfs";
33+ options = [
34+ "ro"
35+ "noatime"
36+ "nofail"
37+ "x-systemd.device-timeout=10s"
38+ ];
39+ };
40+
2741 # The second drive (sdb, ext4) was commented out in CachyOS's fstab too.
2842 # fileSystems."/home/vizie/Games" = {
2943 # device = "/dev/disk/by-uuid/deadbeef-b2a7-406c-9704-4d07e2f38996";
@@ -1,10 +1,9 @@
11 #!/usr/bin/env bash
22 # Puts back what restore-filter lists from the backup drive into the new
33 # system's home folder (MIGRATION.md, step 3). Run it as root from the backup
4-# drive itself, mounted at /mnt:
4+# drive itself, which NixOS mounts read-only at /mnt/backup:
55 #
6-# mount -o ro /dev/disk/by-label/backup /mnt
7-# /mnt/vizie/git/dot/tools/restore-from-sata
6+# /mnt/backup/vizie/git/dot/tools/restore-from-sata
87 set -euo pipefail
98
109 user=vizie