dot
vizie's NixOS desktop: Hyprland, CachyOS kernel and gaming tweaks
| 1 | # Moving from CachyOS to NixOS |
| 2 | |
| 3 | The plan keeps your disk as it is. NixOS goes into new btrfs subvolumes next |
| 4 | to CachyOS's, and `/home` stays the same `@home` subvolume. Your files, game |
| 5 | libraries, app data, `~/.ssh`, Firefox profile and Steam settings never move, |
| 6 | and CachyOS stays bootable until you remove it. |
| 7 | |
| 8 | ## 1. Before you start |
| 9 | |
| 10 | - [ ] Push this repo (`git push`) and the latest `Eiziv/philly`. The install |
| 11 | fetches philly from GitHub. |
| 12 | - [ ] Back up what you can't get back to another disk or machine, in case |
| 13 | something goes wrong with the partition: `~/.ssh`, `~/.config/keys` |
| 14 | (the imsh upload key), `~/.config/Signal` (including `config.json`, which |
| 15 | holds the key to Signal's database), `~/.config/mozilla`, game saves that |
| 16 | aren't in a cloud. |
| 17 | - [ ] Optional: a read-only snapshot of /home to roll back to: |
| 18 | `sudo btrfs subvolume snapshot -r /home /home/.snapshot-pre-nixos` |
| 19 | - [ ] Get the NixOS installer (26.05, graphical or minimal) on a USB stick. |
| 20 | |
| 21 | ## 2. Install |
| 22 | |
| 23 | Boot the installer. Wired network works out of the box. |
| 24 | |
| 25 | ```bash |
| 26 | sudo -i |
| 27 | |
| 28 | # The btrfs partition's top level, to make NixOS's subvolumes. |
| 29 | mkdir -p /mnt/top |
| 30 | mount -o subvolid=5 /dev/nvme0n1p2 /mnt/top |
| 31 | btrfs subvolume create /mnt/top/@nixos |
| 32 | btrfs subvolume create /mnt/top/@nix |
| 33 | btrfs subvolume create /mnt/top/@nixos-log |
| 34 | umount /mnt/top |
| 35 | |
| 36 | # Mount the new system the way hosts/desktop/hardware-configuration.nix does. |
| 37 | o=noatime,compress=zstd |
| 38 | mount -o subvol=@nixos,$o /dev/nvme0n1p2 /mnt |
| 39 | mkdir -p /mnt/{nix,var/log,home,boot} |
| 40 | mount -o subvol=@nix,$o /dev/nvme0n1p2 /mnt/nix |
| 41 | mount -o subvol=@nixos-log,$o /dev/nvme0n1p2 /mnt/var/log |
| 42 | mount -o subvol=@home,$o /dev/nvme0n1p2 /mnt/home |
| 43 | mount /dev/nvme0n1p1 /mnt/boot |
| 44 | |
| 45 | # Compare the generated hardware config with the one in the repo; if the |
| 46 | # kernel modules or anything else differ, keep the generated lines. |
| 47 | nixos-generate-config --root /mnt --show-hardware-config > /tmp/hw.nix |
| 48 | diff /tmp/hw.nix /mnt/home/vizie/git/dot/hosts/desktop/hardware-configuration.nix |
| 49 | |
| 50 | # philly is a private repo: sign in to GitHub for this root shell. |
| 51 | nix --extra-experimental-features 'nix-command flakes' shell nixpkgs#gh -c gh auth login |
| 52 | git config --global credential.helper '!gh auth git-credential' |
| 53 | |
| 54 | # Install. The extra cache is where the CachyOS kernel comes from. |
| 55 | nixos-install --flake /mnt/home/vizie/git/dot#desktop \ |
| 56 | --option extra-substituters https://attic.xuyh0120.win/lantian \ |
| 57 | --option extra-trusted-public-keys lantian:EeAUQ+W+6r7EtwnmYjeVwx5kOGEBpjlBfPlzGlTNvHc= |
| 58 | |
| 59 | # It asks for a root password at the end. Then set yours: |
| 60 | nixos-enter --root /mnt -c 'passwd vizie' |
| 61 | reboot |
| 62 | ``` |
| 63 | |
| 64 | The NixOS boot menu (systemd-boot) becomes the default. CachyOS's Limine stays |
| 65 | in the firmware boot menu (F8 at the ASUS logo), and also on the ESP, next to it. |
| 66 | |
| 67 | ## 3. First boot |
| 68 | |
| 69 | - The login screen is the same gtkgreet over the blurred wallpaper. |
| 70 | - Home Manager replaces the old symlinks in `~/.config` (pointing into |
| 71 | `~/git/dotfiles`) with its own. The old ones are kept beside them with a |
| 72 | `.pre-nixos` suffix, so nothing is overwritten. |
| 73 | - Bolt installs from Flathub in the background on the first boot with network |
| 74 | (`systemctl status flatpak-bolt`). |
| 75 | - "Command not found" suggestions need nix-index's database once: |
| 76 | `nix-index` (takes a few minutes). |
| 77 | - Check the background programs: `systemctl --user list-units --type=service`. |
| 78 | |
| 79 | ## 4. What changed |
| 80 | |
| 81 | What is different from CachyOS, all on purpose: |
| 82 | |
| 83 | - **Packages** are generic x86-64 builds, apart from the kernel (Zen 4) and |
| 84 | proton-cachyos (x86-64-v3). CachyOS rebuilds everything for v3/v4. |
| 85 | - **Snapper** root snapshots are replaced by NixOS generations: each rebuild is |
| 86 | a boot menu entry. `/home` was never snapshotted on CachyOS either. |
| 87 | - **GTK theme**: set in `modules/home/theming.nix`. nwg-look can't save over |
| 88 | those files any more. |
| 89 | - **Signal theme** is built into the package: edit, `rebuild`, `config/signal/restart`. |
| 90 | - **Bitwarden** autostart: the same XDG autostart entry, with NixOS's program name. |
| 91 | - **fish**: only CachyOS's default fish config was there, and your shell is zsh, |
| 92 | so fish isn't set up. |
| 93 | - **vkBasalt's ReShade shaders** in `~/.config/vkBasalt/reshade-shaders` stay in |
| 94 | your home folder; they aren't in this repo (vkBasalt.conf doesn't use them). |
| 95 | - **vkSumi**: its config is kept, but the layer itself wasn't installed on |
| 96 | CachyOS (there is no nixpkgs package for it either). |
| 97 | |
| 98 | Unchanged on purpose, but worth knowing: |
| 99 | |
| 100 | - **kitty's font**: kitty.conf asks for JetBrains Mono, which was never |
| 101 | installed, so kitty has been showing Noto Sans Mono. That's kept. Add |
| 102 | `nerd-fonts.jetbrains-mono` to `fonts.packages` in `modules/nixos/desktop.nix` |
| 103 | to get the font the config names. |
| 104 | - **The login screen opens a kitty terminal** behind gtkgreet |
| 105 | (`hl.exec_cmd("kitty")` in `config/greetd/hyprland.lua`), running as the |
| 106 | greeter user. If gtkgreet ever crashed, that shell would be on screen before |
| 107 | anyone logs in. If it's a leftover from debugging, delete that line. |
| 108 | - **`~/.ssh/authorized_keys`** has a key labelled `chris@echoz.io`, which lets |
| 109 | that key log in as you over SSH (port 22 is open, as before). It stays in your |
| 110 | home folder. |
| 111 | - **mDNS** (port 5353) stays closed in the firewall, as ufw had it. |
| 112 | - **sched-ext** schedulers stay off, as before. See the comment in |
| 113 | `modules/nixos/cachyos.nix` to try one. |
| 114 | |
| 115 | ## 5. Going back to CachyOS |
| 116 | |
| 117 | It still boots (firmware boot menu). Its `~/.config` links now point into |
| 118 | NixOS's store, which CachyOS doesn't have, so rerun the old repo's script there: |
| 119 | `~/git/dotfiles/symlink.sh`. |
| 120 | |
| 121 | ## 6. Once you're happy |
| 122 | |
| 123 | Remove CachyOS: boot NixOS, mount the top level, delete its subvolumes |
| 124 | (`@`, `@root`, `@srv`, `@cache`, `@tmp`, `@log`), then its kernels and Limine |
| 125 | files from the ESP (look first: `sudo ls -R /boot`; NixOS's own files are |
| 126 | `/boot/EFI/nixos`, `/boot/EFI/systemd`, `/boot/EFI/BOOT` and `/boot/loader`), |
| 127 | and its firmware boot entry (`efibootmgr`). |