# Moving from CachyOS to NixOS The plan keeps your disk as it is. NixOS goes into new btrfs subvolumes next to CachyOS's, and `/home` stays the same `@home` subvolume. Your files, game libraries, app data, `~/.ssh`, Firefox profile and Steam settings never move, and CachyOS stays bootable until you remove it. ## 1. Before you start - [ ] Push this repo (`git push`) and the latest `Eiziv/philly`. The install fetches philly from GitHub. - [ ] Back up what you can't get back to another disk or machine, in case something goes wrong with the partition: `~/.ssh`, `~/.config/keys` (the imsh upload key), `~/.config/Signal` (including `config.json`, which holds the key to Signal's database), `~/.config/mozilla`, game saves that aren't in a cloud. - [ ] Optional: a read-only snapshot of /home to roll back to: `sudo btrfs subvolume snapshot -r /home /home/.snapshot-pre-nixos` - [ ] Get the NixOS installer (26.05, graphical or minimal) on a USB stick. ## 2. Install Boot the installer. Wired network works out of the box. ```bash sudo -i # The btrfs partition's top level, to make NixOS's subvolumes. mkdir -p /mnt/top mount -o subvolid=5 /dev/nvme0n1p2 /mnt/top btrfs subvolume create /mnt/top/@nixos btrfs subvolume create /mnt/top/@nix btrfs subvolume create /mnt/top/@nixos-log umount /mnt/top # Mount the new system the way hosts/desktop/hardware-configuration.nix does. o=noatime,compress=zstd mount -o subvol=@nixos,$o /dev/nvme0n1p2 /mnt mkdir -p /mnt/{nix,var/log,home,boot} mount -o subvol=@nix,$o /dev/nvme0n1p2 /mnt/nix mount -o subvol=@nixos-log,$o /dev/nvme0n1p2 /mnt/var/log mount -o subvol=@home,$o /dev/nvme0n1p2 /mnt/home mount /dev/nvme0n1p1 /mnt/boot # Compare the generated hardware config with the one in the repo; if the # kernel modules or anything else differ, keep the generated lines. nixos-generate-config --root /mnt --show-hardware-config > /tmp/hw.nix diff /tmp/hw.nix /mnt/home/vizie/git/dot/hosts/desktop/hardware-configuration.nix # philly is a private repo: sign in to GitHub for this root shell. nix --extra-experimental-features 'nix-command flakes' shell nixpkgs#gh -c gh auth login git config --global credential.helper '!gh auth git-credential' # Install. The extra cache is where the CachyOS kernel comes from. nixos-install --flake /mnt/home/vizie/git/dot#desktop \ --option extra-substituters https://attic.xuyh0120.win/lantian \ --option extra-trusted-public-keys lantian:EeAUQ+W+6r7EtwnmYjeVwx5kOGEBpjlBfPlzGlTNvHc= # It asks for a root password at the end. Then set yours: nixos-enter --root /mnt -c 'passwd vizie' reboot ``` The NixOS boot menu (systemd-boot) becomes the default. CachyOS's Limine stays in the firmware boot menu (F8 at the ASUS logo), and also on the ESP, next to it. ## 3. First boot - The login screen is the same gtkgreet over the blurred wallpaper. - Home Manager replaces the old symlinks in `~/.config` (pointing into `~/git/dotfiles`) with its own. The old ones are kept beside them with a `.pre-nixos` suffix, so nothing is overwritten. - Bolt installs from Flathub in the background on the first boot with network (`systemctl status flatpak-bolt`). - "Command not found" suggestions need nix-index's database once: `nix-index` (takes a few minutes). - Check the background programs: `systemctl --user list-units --type=service`. ## 4. What changed What is different from CachyOS, all on purpose: - **Packages** are generic x86-64 builds, apart from the kernel (Zen 4) and proton-cachyos (x86-64-v3). CachyOS rebuilds everything for v3/v4. - **Snapper** root snapshots are replaced by NixOS generations: each rebuild is a boot menu entry. `/home` was never snapshotted on CachyOS either. - **GTK theme**: set in `modules/home/theming.nix`. nwg-look can't save over those files any more. - **Signal theme** is built into the package: edit, `rebuild`, `config/signal/restart`. - **Bitwarden** autostart: the same XDG autostart entry, with NixOS's program name. - **fish**: only CachyOS's default fish config was there, and your shell is zsh, so fish isn't set up. - **vkBasalt's ReShade shaders** in `~/.config/vkBasalt/reshade-shaders` stay in your home folder; they aren't in this repo (vkBasalt.conf doesn't use them). - **vkSumi**: its config is kept, but the layer itself wasn't installed on CachyOS (there is no nixpkgs package for it either). Unchanged on purpose, but worth knowing: - **kitty's font**: kitty.conf asks for JetBrains Mono, which was never installed, so kitty has been showing Noto Sans Mono. That's kept. Add `nerd-fonts.jetbrains-mono` to `fonts.packages` in `modules/nixos/desktop.nix` to get the font the config names. - **The login screen opens a kitty terminal** behind gtkgreet (`hl.exec_cmd("kitty")` in `config/greetd/hyprland.lua`), running as the greeter user. If gtkgreet ever crashed, that shell would be on screen before anyone logs in. If it's a leftover from debugging, delete that line. - **`~/.ssh/authorized_keys`** has a key labelled `chris@echoz.io`, which lets that key log in as you over SSH (port 22 is open, as before). It stays in your home folder. - **mDNS** (port 5353) stays closed in the firewall, as ufw had it. - **sched-ext** schedulers stay off, as before. See the comment in `modules/nixos/cachyos.nix` to try one. ## 5. Going back to CachyOS It still boots (firmware boot menu). Its `~/.config` links now point into NixOS's store, which CachyOS doesn't have, so rerun the old repo's script there: `~/git/dotfiles/symlink.sh`. ## 6. Once you're happy Remove CachyOS: boot NixOS, mount the top level, delete its subvolumes (`@`, `@root`, `@srv`, `@cache`, `@tmp`, `@log`), then its kernels and Limine files from the ESP (look first: `sudo ls -R /boot`; NixOS's own files are `/boot/EFI/nixos`, `/boot/EFI/systemd`, `/boot/EFI/BOOT` and `/boot/loader`), and its firmware boot entry (`efibootmgr`).