dot

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

200 lines9663 bytesMarkdown
1# Moving from CachyOS to NixOS
2
3The install wipes the whole NVMe drive (`nvme0n1`, the 980 PRO) and lays it out
4again with disko, as `hosts/desktop/disko.nix` describes. CachyOS and everything
5in it are gone afterwards, so your home folder goes to the Kingston SATA SSD
6(`sda`) first and comes back after the install. Game installs aren't backed up
7(see `backup-filter`): Steam games and WoW download again. WoW's settings and
8addons are kept.
9
10The other SATA SSD (`sdb`) isn't touched at any point. disko only knows the
11NVMe drive, by its serial number.
12
13## 1. Before you start (on CachyOS)
14
15- [ ] Push this repo and the latest `Eiziv/philly`.
16- [ ] Get the NixOS installer (26.05, minimal is enough) on a USB stick, and
17 make sure Secure Boot is off in the firmware, as it is for Limine now.
18- [ ] Optional, but this is the last chance: record WoW's performance on
19 CachyOS, to compare with NixOS later. In Faugus, edit Battle.net, turn
20 on MangoHud and add this line to the launch arguments:
21 `MANGOHUD_CONFIG=read_cfg,output_folder=/home/vizie/benchmarks,log_duration=60,log_interval=0`.
22 In game, stand somewhere you can return to (a busy city), keep the camera
23 still and press Left Shift+F2. Do it three times. The logs land in
24 `~/benchmarks`, which the backup includes. Do the same on NixOS later,
25 then compare the two with `~/git/dot/tools/bench-compare`.
26
27The backup can be made ahead of time, days before the install if you like.
28Right before the wipe you run the two rsync commands below again (and the
29"save the built system" step, if the config changed since); they only copy
30what changed, so that takes a minute or two.
31
32`tools/backup-to-sata` does all of the steps below in one go (run it with
33`sudo`; it only formats the Kingston if it is empty). They are spelled out here
34too, in case you'd rather do them by hand.
35
36**Prepare the backup drive** (once). This erases `sda`, the 112 GB Kingston, which
37is empty now. Check that the name points at `sda` first:
38
39```bash
40ls -l /dev/disk/by-id/ata-KINGSTON_SA400S37120G_50026B76820FD3CE
41sudo mkfs.btrfs -L backup /dev/disk/by-id/ata-KINGSTON_SA400S37120G_50026B76820FD3CE
42sudo mkdir -p /mnt/backup
43sudo mount -o compress=zstd /dev/disk/by-label/backup /mnt/backup
44sudo install -d -o vizie /mnt/backup/nix-cache /mnt/backup/wow
45```
46
47**Save the built system.** The finished system and the disko script go onto
48the backup drive, so the installer doesn't have to build anything (or compile
49the CachyOS kernel, if its binary cache is still down):
50
51```bash
52cd ~/git/dot
53sys=$(nix build --no-link --print-out-paths .#nixosConfigurations.desktop.config.system.build.toplevel)
54disko=$(nix build --no-link --print-out-paths .#nixosConfigurations.desktop.config.system.build.diskoScript)
55nix copy --to 'file:///mnt/backup/nix-cache?compression=zstd' "$sys" "$disko"
56echo "$sys" > /mnt/backup/nix-cache/system
57echo "$disko" > /mnt/backup/nix-cache/disko
58```
59
60**Back up WoW's settings and addons** (`WTF` is keybinds, macros and addon
61settings, `Interface` is the addons):
62
63```bash
64rsync -a --delete ~/Games/battlenet/drive_c/'Program Files (x86)'/'World of Warcraft'/_retail_/{WTF,Interface} /mnt/backup/wow/
65```
66
67**Back up your home folder.** Quit Signal, Discord, Firefox, Claude and the
68games first, so their databases aren't copied halfway through a write. About
6983 GB before compression, and the saved system adds roughly 10 GB, so it fits
70the 112 GB drive with some room. If it runs out of space, leave out repos that
71are pushed to GitHub (the biggest are `git/skate3`, 23 GB, and `git/philly`,
7216 GB) with an extra `--exclude=/git/skate3/`:
73
74```bash
75sudo rsync -aHAXx --delete --info=progress2 --filter='merge /home/vizie/git/dot/backup-filter' /home/vizie/ /mnt/backup/vizie/
76```
77
78Check that it looks complete (`ls -a /mnt/backup/vizie`, `du -sh /mnt/backup/*`),
79then `sudo umount /mnt/backup`. To update the backup later, mount it again
80(`sudo mount -o compress=zstd /dev/disk/by-label/backup /mnt/backup`) and rerun
81the commands above.
82
83## 2. Install
84
85Boot the installer. Wired network works out of the box; the install itself
86doesn't need it.
87
88```bash
89sudo -i
90
91# The backup drive, read-only. Not under /mnt: disko unmounts everything there.
92mkdir /backup
93mount -o ro /dev/disk/by-label/backup /backup
94sys=$(cat /backup/nix-cache/system)
95disko=$(cat /backup/nix-cache/disko)
96
97# The disko script. It doesn't ask before it wipes, so check that the drive it
98# names is the 980 PRO (nvme0n1) one last time.
99ls -l /dev/disk/by-id/nvme-Samsung_SSD_980_PRO_1TB_S5GXNF1R877751D
100nix --extra-experimental-features nix-command copy --no-check-sigs --from file:///backup/nix-cache "$disko"
101
102# Wipe, partition, format and mount the NVMe drive at /mnt.
103"$disko"
104
105# Copy the system onto it and install it, with the boot loader.
106nix --extra-experimental-features nix-command copy --no-check-sigs \
107 --from file:///backup/nix-cache --to 'local?root=/mnt' "$sys"
108nixos-install --system "$sys" --no-channel-copy
109# It asks for a root password at the end.
110
111# What you chose to keep of your home folder (restore-filter), owned by you
112# (uid 1000, group users). The rest stays on the backup drive.
113rsync -aHAX --info=progress2 --chown=1000:100 \
114 --filter='merge /backup/vizie/git/dot/restore-filter' /backup/vizie/ /mnt/home/vizie/
115nixos-enter --root /mnt -c 'passwd vizie'
116reboot
117```
118
119If something in `/backup/nix-cache` is missing, install from the flake instead
120(this needs the network, and compiles the kernel if its cache is down):
121`nixos-install --flake /backup/vizie/git/dot#desktop` after
122`nix run github:nix-community/disko/latest -- --mode destroy,format,mount /backup/vizie/git/dot/hosts/desktop/disko.nix`.
123
124## 3. First boot
125
126- The login screen is the same gtkgreet over the blurred wallpaper.
127- Only what `restore-filter` lists came back: app data and logins, SSH keys,
128 shell history, `~/git/dot`, Steam's settings and saves. Everything else
129 (Downloads, the other repos, CachyOS leftovers) is on the backup drive under
130 `vizie/`: `sudo mount -o ro /dev/disk/by-label/backup /mnt` to copy something
131 back.
132- "Command not found" suggestions need nix-index's database once:
133 `nix-index` (takes a few minutes).
134- Check the background programs: `systemctl --user list-units --type=service`.
135
136## 4. What changed
137
138What is different from CachyOS, all on purpose:
139
140- **Packages** are generic x86-64 builds, apart from the kernel (Zen 4) and
141 proton-cachyos (x86-64-v3). CachyOS rebuilds everything for v3/v4.
142- **Snapper** root snapshots are replaced by NixOS generations: each rebuild is
143 a boot menu entry. `/home` was never snapshotted on CachyOS either.
144- **GTK theme**: set in `modules/home/theming.nix`. nwg-look can't save over
145 those files any more.
146- **Signal theme** is built into the package: edit, `rebuild`, `config/signal/restart`.
147- **Bitwarden** autostart: the same XDG autostart entry, with NixOS's program name.
148- **fish**: only CachyOS's default fish config was there, and your shell is zsh,
149 so fish isn't set up.
150- **vkBasalt's ReShade shaders** in `~/.config/vkBasalt/reshade-shaders` stay in
151 your home folder; they aren't in this repo (vkBasalt.conf doesn't use them).
152- **vkSumi**: its config is kept, but the layer itself wasn't installed on
153 CachyOS (there is no nixpkgs package for it either).
154
155Unchanged on purpose, but worth knowing:
156
157- **kitty's font**: kitty.conf asks for JetBrains Mono, which was never
158 installed, so kitty has been showing Noto Sans Mono. That's kept. Add
159 `nerd-fonts.jetbrains-mono` to `fonts.packages` in `modules/nixos/desktop.nix`
160 to get the font the config names.
161- **The login screen opens a kitty terminal** behind gtkgreet
162 (`hl.exec_cmd("kitty")` in `config/greetd/hyprland.lua`), running as the
163 greeter user. If gtkgreet ever crashed, that shell would be on screen before
164 anyone logs in. If it's a leftover from debugging, delete that line.
165- **`~/.ssh/authorized_keys`** has a key labelled `chris@echoz.io`, which lets
166 that key log in as you over SSH (port 22 is open, as before). It stays in your
167 home folder.
168- **mDNS** (port 5353) stays closed in the firewall, as ufw had it.
169- **sched-ext** schedulers stay off, as before. See the comment in
170 `modules/nixos/cachyos.nix` to try one.
171
172## 5. Games
173
174- **Steam**: your settings, Proton versions and game saves (`compatdata`) are
175 back. The games in `~/Games/SteamLibrary` and Steam's own library show as
176 not installed; install them again. Steam may need the library folder
177 re-added (Settings → Storage).
178- **WoW**: in Faugus, remove the old Battle.net entry and add Battle.net again
179 (Faugus installs it into a new prefix at `~/Games/battlenet`). Pick the same
180 runner, `Proton-CachyOS Latest` (it's back in
181 `~/.local/share/Steam/compatibilitytools.d`), and the same launch arguments:
182 `WINE_SIMULATE_WRITECOPY=1` and `PROTON_ENABLE_WAYLAND=0`. Install WoW, then
183 copy your settings and addons back before you start it:
184
185 ```bash
186 sudo mount -o ro /dev/disk/by-label/backup /mnt
187 cp -a /mnt/wow/{WTF,Interface} ~/Games/battlenet/drive_c/'Program Files (x86)'/'World of Warcraft'/_retail_/
188 sudo umount /mnt
189 ```
190
191- **OSRS**: install the official Old School RuneScape launcher. Bolt is gone,
192 and so is its data.
193
194## 6. Once you're happy
195
196The backup on `sda` stays until you need the drive for something else. It is
197the only copy of what wasn't restored, including the repos that exist only
198here (`skate3`, `skate-game`, `he60`, `move`, and `Left4Resi`'s uncommitted
199changes), so copy out anything you want before reusing the drive. NixOS
200doesn't mount it; `sudo mount /dev/disk/by-label/backup /mnt` gets you into it.