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