dot

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

152 lines6845 bytesMarkdown
1# Moving from CachyOS to NixOS
2
3[nixos-anywhere]https://github.com/nix-community/nixos-anywhere installs
4NixOS from the MacBook over SSH. It switches the running CachyOS into a NixOS
5installer in RAM (kexec), wipes the NVMe drive and lays it out as
6`hosts/desktop/disko.nix` says, builds the system on the desktop itself and
7reboots into it. No USB stick, and nothing Linux gets built on the Mac.
8
9CachyOS and everything on the NVMe drive are gone afterwards. Your home folder
10is backed up to the Kingston SATA SSD (`sda`) first, and only what
11`restore-filter` lists comes back: it's a fresh start. The other SATA SSD
12(`sdb`) is never touched.
13
14## 1. On the desktop (CachyOS)
15
16- [ ] Optional, but the last chance: record WoW's performance to compare
17 later. In Faugus, edit Battle.net, turn on MangoHud and add this line to
18 the launch arguments:
19 `MANGOHUD_CONFIG=read_cfg,output_folder=/home/vizie/benchmarks,log_duration=60,log_interval=0`.
20 In game, stand somewhere you can return to (a busy city), keep the camera
21 still and press Left Shift+F2. Do it three times. Do the same on NixOS
22 later and compare with `~/git/dot/tools/bench-compare`.
23- [ ] Quit Signal, Discord, Firefox, Claude and the games, then update the
24 backup (only what changed since the last run is copied):
25
26 ```bash
27 sudo ~/git/dot/tools/backup-to-sata
28 ```
29
30- [ ] Let the Mac log in as root, which nixos-anywhere needs. Paste the Mac's
31 public key (`cat ~/.ssh/id_ed25519.pub` on the Mac) into:
32
33 ```bash
34 sudo install -d -m700 /root/.ssh && sudo nano /root/.ssh/authorized_keys
35 ```
36
37## 2. On the Mac
38
39Needs Nix (with flakes) and the GitHub CLI signed in to your account: `dot`
40and `philly` are private, and `gh auth setup-git` lets Nix fetch them. The
41Mac's public key must also be in `macKeys` in `hosts/desktop/default.nix`
42(committed and pushed), so it can still log in after the install.
43
44```bash
45gh auth setup-git
46gh repo clone Eiziv/dot ~/dot
47```
48
49Check from the Mac that `ssh root@10.0.0.40` logs in. Then install. **This wipes
50the desktop's NVMe drive** without asking again:
51
52```bash
53nix run github:nix-community/nixos-anywhere -- --flake ~/dot#desktop --build-on remote --copy-host-keys --no-use-machine-substituters root@10.0.0.40
54```
55
56It takes a while: the CachyOS kernel's binary cache has been down, so the
57kernel compiles on the desktop. `--no-use-machine-substituters` skips that
58cache; if it's back up (`curl -sI https://attic.xuyh0120.win/lantian/nix-cache-info`
59gives 200), leave the flag out and the kernel downloads instead. The desktop
60reboots into NixOS at the end.
61
62## 3. After the reboot
63
64From the Mac (its key is in the config, for root and for you):
65
66```bash
67ssh root@10.0.0.40
68passwd vizie
69mount -o ro /dev/disk/by-label/backup /mnt
70/mnt/vizie/git/dot/tools/restore-from-sata
71umount /mnt
72```
73
74Then log in on the desktop.
75
76## 4. On the new system
77
78- The login screen is the same gtkgreet over the blurred wallpaper.
79- Only what `restore-filter` lists came back: app data and logins, SSH keys,
80 shell history, `~/git/dot`, Steam's settings and saves. Everything else
81 (Downloads, the other repos, CachyOS leftovers) is on the backup drive under
82 `vizie/`: `sudo mount -o ro /dev/disk/by-label/backup /mnt` to copy something
83 back.
84- "Command not found" suggestions need nix-index's database once:
85 `nix-index` (takes a few minutes).
86- Check the background programs: `systemctl --user list-units --type=service`.
87
88## 5. What changed
89
90What is different from CachyOS, all on purpose:
91
92- **Packages** are generic x86-64 builds, apart from the kernel (Zen 4) and
93 proton-cachyos (x86-64-v3). CachyOS rebuilds everything for v3/v4.
94- **Snapper** root snapshots are replaced by NixOS generations: each rebuild is
95 a boot menu entry. `/home` was never snapshotted on CachyOS either.
96- **GTK theme**: set in `modules/home/theming.nix`. nwg-look can't save over
97 those files any more.
98- **Signal theme** is built into the package: edit, `rebuild`, `config/signal/restart`.
99- **Bitwarden** autostart: the same XDG autostart entry, with NixOS's program name.
100- **fish**: only CachyOS's default fish config was there, and your shell is zsh,
101 so fish isn't set up.
102- **vkBasalt's ReShade shaders** in `~/.config/vkBasalt/reshade-shaders` stay in
103 your home folder; they aren't in this repo (vkBasalt.conf doesn't use them).
104- **vkSumi**: its config is kept, but the layer itself wasn't installed on
105 CachyOS (there is no nixpkgs package for it either).
106
107Unchanged on purpose, but worth knowing:
108
109- **kitty's font**: kitty.conf asks for JetBrains Mono, which was never
110 installed, so kitty has been showing Noto Sans Mono. That's kept. Add
111 `nerd-fonts.jetbrains-mono` to `fonts.packages` in `modules/nixos/desktop.nix`
112 to get the font the config names.
113- **The login screen opens a kitty terminal** behind gtkgreet
114 (`hl.exec_cmd("kitty")` in `config/greetd/hyprland.lua`), running as the
115 greeter user. If gtkgreet ever crashed, that shell would be on screen before
116 anyone logs in. If it's a leftover from debugging, delete that line.
117- **`~/.ssh/authorized_keys`** has a key labelled `chris@echoz.io`, which lets
118 that key log in as you over SSH (port 22 is open, as before). It stays in your
119 home folder.
120- **mDNS** (port 5353) stays closed in the firewall, as ufw had it.
121- **sched-ext** schedulers stay off, as before. See the comment in
122 `modules/nixos/cachyos.nix` to try one.
123
124## 6. Games
125
126- **Steam**: your settings, Proton versions and game saves (`compatdata`) are
127 back. The games in `~/Games/SteamLibrary` and Steam's own library show as
128 not installed; install them again. Steam may need the library folder
129 re-added (Settings → Storage).
130- **WoW**: in Faugus, remove the old Battle.net entry and add Battle.net again
131 (Faugus installs it into a new prefix at `~/Games/battlenet`). Pick the same
132 runner, `Proton-CachyOS Latest` (it's back in
133 `~/.local/share/Steam/compatibilitytools.d`), and the same launch arguments:
134 `WINE_SIMULATE_WRITECOPY=1` and `PROTON_ENABLE_WAYLAND=0`. Install WoW, then
135 copy your settings and addons back before you start it:
136
137 ```bash
138 sudo mount -o ro /dev/disk/by-label/backup /mnt
139 cp -a /mnt/wow/{WTF,Interface} ~/Games/battlenet/drive_c/'Program Files (x86)'/'World of Warcraft'/_retail_/
140 sudo umount /mnt
141 ```
142
143- **OSRS**: install the official Old School RuneScape launcher. Bolt is gone,
144 and so is its data.
145
146## 7. Once you're happy
147
148The backup on `sda` stays until you need the drive for something else. It is
149the only copy of what wasn't restored, including the repos that exist only
150here (`skate3`, `skate-game`, `he60`, `move`, and `Left4Resi`'s uncommitted
151changes), so copy out anything you want before reusing the drive. NixOS
152doesn't mount it; `sudo mount /dev/disk/by-label/backup /mnt` gets you into it.