dot
vizie's NixOS desktop: Hyprland, CachyOS kernel and gaming tweaks
| 1 | # Moving from CachyOS to NixOS |
| 2 | |
| 3 | [nixos-anywhere](https://github.com/nix-community/nixos-anywhere) installs |
| 4 | NixOS from the MacBook over SSH. It switches the running CachyOS into a NixOS |
| 5 | installer 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 |
| 7 | reboots into it. No USB stick, and nothing Linux gets built on the Mac. |
| 8 | |
| 9 | CachyOS and everything on the NVMe drive are gone afterwards. Your home folder |
| 10 | is 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 | ## 2. On the Mac |
| 31 | |
| 32 | Needs Nix (with flakes) and the GitHub CLI signed in to your account: `dot` |
| 33 | and `philly` are private, and `gh auth setup-git` lets Nix fetch them. The |
| 34 | Mac's public key must also be in `macKeys` in `hosts/desktop/default.nix` |
| 35 | (committed and pushed), so it can log in to the new system. |
| 36 | |
| 37 | ```bash |
| 38 | gh auth setup-git |
| 39 | gh repo clone Eiziv/dot ~/dot |
| 40 | cd ~/dot && nix develop |
| 41 | ``` |
| 42 | |
| 43 | `nix develop` opens a shell with nixos-anywhere in it. Then install. It logs |
| 44 | in as you (with your password, or the Mac's key if CachyOS has it), asks for |
| 45 | your sudo password once, and from then on **wipes the desktop's NVMe drive** |
| 46 | without asking again: |
| 47 | |
| 48 | ```bash |
| 49 | nixos-anywhere --flake .#desktop --build-on remote --copy-host-keys --no-use-machine-substituters vizie@10.0.0.40 |
| 50 | ``` |
| 51 | |
| 52 | It takes a while: the CachyOS kernel's binary cache has been down, so the |
| 53 | kernel compiles on the desktop. `--no-use-machine-substituters` skips that |
| 54 | cache; if it's back up (`curl -sI https://attic.xuyh0120.win/lantian/nix-cache-info` |
| 55 | gives 200), leave the flag out and the kernel downloads instead. The desktop |
| 56 | reboots into NixOS at the end. |
| 57 | |
| 58 | ## 3. After the reboot |
| 59 | |
| 60 | From the Mac (its key is in the config, for root and for you): |
| 61 | |
| 62 | ```bash |
| 63 | ssh root@10.0.0.40 |
| 64 | passwd vizie |
| 65 | mount -o ro /dev/disk/by-label/backup /mnt |
| 66 | /mnt/vizie/git/dot/tools/restore-from-sata |
| 67 | umount /mnt |
| 68 | ``` |
| 69 | |
| 70 | Then log in on the desktop. |
| 71 | |
| 72 | ## 4. On the new system |
| 73 | |
| 74 | - The login screen is the same gtkgreet over the blurred wallpaper. |
| 75 | - Only what `restore-filter` lists came back: app data and logins, SSH keys, |
| 76 | 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. |
| 80 | - "Command not found" suggestions need nix-index's database once: |
| 81 | `nix-index` (takes a few minutes). |
| 82 | - Check the background programs: `systemctl --user list-units --type=service`. |
| 83 | |
| 84 | ## 5. What changed |
| 85 | |
| 86 | What is different from CachyOS, all on purpose: |
| 87 | |
| 88 | - **Packages** are generic x86-64 builds, apart from the kernel (Zen 4) and |
| 89 | proton-cachyos (x86-64-v3). CachyOS rebuilds everything for v3/v4. |
| 90 | - **Snapper** root snapshots are replaced by NixOS generations: each rebuild is |
| 91 | a boot menu entry. `/home` was never snapshotted on CachyOS either. |
| 92 | - **GTK theme**: set in `modules/home/theming.nix`. nwg-look can't save over |
| 93 | those files any more. |
| 94 | - **Signal theme** is built into the package: edit, `rebuild`, `config/signal/restart`. |
| 95 | - **Bitwarden** autostart: the same XDG autostart entry, with NixOS's program name. |
| 96 | - **fish**: only CachyOS's default fish config was there, and your shell is zsh, |
| 97 | so fish isn't set up. |
| 98 | - **vkBasalt's ReShade shaders** in `~/.config/vkBasalt/reshade-shaders` stay in |
| 99 | your home folder; they aren't in this repo (vkBasalt.conf doesn't use them). |
| 100 | - **vkSumi**: its config is kept, but the layer itself wasn't installed on |
| 101 | CachyOS (there is no nixpkgs package for it either). |
| 102 | |
| 103 | Unchanged on purpose, but worth knowing: |
| 104 | |
| 105 | - **kitty's font**: kitty.conf asks for JetBrains Mono, which was never |
| 106 | installed, so kitty has been showing Noto Sans Mono. That's kept. Add |
| 107 | `nerd-fonts.jetbrains-mono` to `fonts.packages` in `modules/nixos/desktop.nix` |
| 108 | to get the font the config names. |
| 109 | - **The login screen opens a kitty terminal** behind gtkgreet |
| 110 | (`hl.exec_cmd("kitty")` in `config/greetd/hyprland.lua`), running as the |
| 111 | greeter user. If gtkgreet ever crashed, that shell would be on screen before |
| 112 | anyone logs in. If it's a leftover from debugging, delete that line. |
| 113 | - **`~/.ssh/authorized_keys`** has a key labelled `chris@echoz.io`, which lets |
| 114 | that key log in as you over SSH (port 22 is open, as before). It stays in your |
| 115 | home folder. |
| 116 | - **mDNS** (port 5353) stays closed in the firewall, as ufw had it. |
| 117 | - **sched-ext** schedulers stay off, as before. See the comment in |
| 118 | `modules/nixos/cachyos.nix` to try one. |
| 119 | |
| 120 | ## 6. Games |
| 121 | |
| 122 | - **Steam**: your settings, Proton versions and game saves (`compatdata`) are |
| 123 | back. The games in `~/Games/SteamLibrary` and Steam's own library show as |
| 124 | not installed; install them again. Steam may need the library folder |
| 125 | re-added (Settings → Storage). |
| 126 | - **WoW**: in Faugus, remove the old Battle.net entry and add Battle.net again |
| 127 | (Faugus installs it into a new prefix at `~/Games/battlenet`). Pick the same |
| 128 | runner, `Proton-CachyOS Latest` (it's back in |
| 129 | `~/.local/share/Steam/compatibilitytools.d`), and the same launch arguments: |
| 130 | `WINE_SIMULATE_WRITECOPY=1` and `PROTON_ENABLE_WAYLAND=0`. Install WoW, then |
| 131 | copy your settings and addons back before you start it: |
| 132 | |
| 133 | ```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 |
| 137 | ``` |
| 138 | |
| 139 | - **OSRS**: install the official Old School RuneScape launcher. Bolt is gone, |
| 140 | and so is its data. |
| 141 | |
| 142 | ## 7. Once you're happy |
| 143 | |
| 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. |