MIGRATION.md
7108fc28e06a6326f7a04251cc95bbe50ced6133
· 12.6 KB · 249 lines
raw
| 1 | # Migrating guix-dotfiles onto nix-combined |
| 2 | |
| 3 | This repo supersedes `guix-dotfiles/home-config/nix-home-manager` (the ad-hoc |
| 4 | home-manager flake guix-dotfiles was already using) and pulls Linux desktop |
| 5 | config that used to live in `guix-dotfiles/home-config/home-configuration.scm` |
| 6 | into home-manager proper. It does **not** replace Guix itself: package |
| 7 | management, the system config, and three specific home services stay in |
| 8 | Guix (see "Stays in Guix" below). |
| 9 | |
| 10 | `nix-combined` is deliberately its own repo (own history, own remote) so |
| 11 | that darwin machines never need to clone anything guix-related. It's wired |
| 12 | into `guix-dotfiles` as a **git submodule** at |
| 13 | `guix-dotfiles/home-config/nix-combined` - the rest of this section covers |
| 14 | that wiring; everything after "Stays in Guix" is still a plan for you to |
| 15 | apply by hand. |
| 16 | |
| 17 | ## 1. Submodule wiring (already done in this working tree) |
| 18 | |
| 19 | Already applied, not yet committed/pushed - review with `git status`/`git |
| 20 | diff` in `guix-dotfiles` before committing: |
| 21 | |
| 22 | - `guix-dotfiles/.gitmodules` added, pointing `home-config/nix-combined` at |
| 23 | **the local filesystem path** to this checkout of `nix-combined`. That |
| 24 | only works on this machine. **Before pushing**, create the real remote |
| 25 | (recommend `https://git.rschanz.org/nix-combined`, matching the |
| 26 | `nix-dotfiles`/`guix-dotfiles` naming convention) and push `nix-combined` |
| 27 | there, then run, from `guix-dotfiles`: |
| 28 | ``` |
| 29 | git submodule set-url home-config/nix-combined https://git.rschanz.org/nix-combined |
| 30 | git add .gitmodules |
| 31 | git commit |
| 32 | ``` |
| 33 | - `home-configuration.scm`'s `%home-symlinks` now points |
| 34 | `.config/guix/home-config/nix-combined` at `.config/home-manager` |
| 35 | (previously `.config/guix/home-config/nix-home-manager`). |
| 36 | - `deploy.sh`'s fresh-install clone now uses `git clone --recurse-submodules` |
| 37 | so a from-scratch deploy pulls `nix-combined` in the same step. |
| 38 | |
| 39 | **On existing machines**, after pulling this change: |
| 40 | ``` |
| 41 | git submodule update --init --recursive |
| 42 | ``` |
| 43 | (or `git clone --recurse-submodules` next time you clone `guix-dotfiles` |
| 44 | fresh). Then switch with `home-manager switch --flake ~/.config/home-manager#ryan` |
| 45 | (the `rebuild` zsh alias does this on Linux). |
| 46 | |
| 47 | **Updating `nix-combined` later**: since the submodule pins an exact commit, |
| 48 | pulling new `nix-combined` changes needs a bump in `guix-dotfiles`: |
| 49 | ``` |
| 50 | cd home-config/nix-combined && git pull origin main && cd - |
| 51 | git add home-config/nix-combined |
| 52 | git commit -m "bump nix-combined" |
| 53 | ``` |
| 54 | |
| 55 | The old `guix-dotfiles/home-config/nix-home-manager` directory (the |
| 56 | pre-submodule ad-hoc flake) can be deleted once you've confirmed the new |
| 57 | one builds and switches cleanly. |
| 58 | |
| 59 | **Leave the `nix-config` symlink entry alone for the first switch.** It's |
| 60 | what sets `experimental-features = nix-command flakes` for your user today, |
| 61 | which is what lets `home-manager`/`nix` read this flake at all - |
| 62 | home-manager can't bootstrap its own prerequisite. `linux.nix` now writes |
| 63 | its own `~/.config/nix/nix.conf` and `~/.config/nix/registry.json` via |
| 64 | `xdg.configFile`, so *after* the first successful switch, remove the |
| 65 | `nix-config` entry from `%home-symlinks` too - otherwise HM's files resolve |
| 66 | through that symlink and land as untracked files inside the guix-dotfiles |
| 67 | checkout instead of in the Nix store. |
| 68 | |
| 69 | ## 2. Remove entries `home-configuration.scm` now duplicates |
| 70 | |
| 71 | Once nix-combined delivers a path, Guix must stop also writing it, or |
| 72 | activation will collide (two things trying to own the same symlink target). |
| 73 | In `home-configuration.scm`'s `home-xdg-configuration-files-service-type` and |
| 74 | `home-files-service-type`, remove these lines (nix-combined now owns them): |
| 75 | |
| 76 | - `"nvim/init.vim"`, `"nvim/after/ftplugin/markdown/custom.vim"`, |
| 77 | `"nvim/after/ftplugin/mail/custom.vim"` - nix-combined's neovim config |
| 78 | (lazy.nvim-based, in `users/ryan/modules/nvim`) is the canonical one now; |
| 79 | the old vim-plug based `nvim/config/init.vim` + `plug.vim` is superseded. |
| 80 | - `"hypr/monitors.conf"`, `"hypr/pyprland.toml"`, `"hypr/family_guy.mp4"`, |
| 81 | `"hypr/hyprlock.conf"`, `"hypr/hypridle.conf"`, `"hypr/kanshi.conf"`, |
| 82 | `"hypr/subwaysurfer.webm"`, `"hypr/scripts"` (the `hyprland.conf` itself |
| 83 | was already coming from the old nix-home-manager flake, unchanged in |
| 84 | spirit here - just re-homed) |
| 85 | - `"wpaperd"`, `"mpv"`, `"foot"`, `"waybar"`, `"alacritty"`, `"aerc"` |
| 86 | - `"pulse/client.conf"` |
| 87 | - `.local/share/nvim/site/autoload/plug.vim` (dead once nvim is lazy.nvim-based) |
| 88 | - `.local/share/mailvelope`, `.mozilla/native-messaging-hosts/tridactyl.json`, |
| 89 | `.local/share/tridactyl` |
| 90 | - **`.icons`** (from `home-files-service-type`) - this one isn't optional |
| 91 | cleanup, it's a hard prerequisite. Guix delivers `.icons` today as a |
| 92 | single recursive `local-file` symlink, but `linux.nix`'s |
| 93 | `home.pointerCursor` (with `x11.enable = true`) needs to write |
| 94 | `~/.icons/default/index.theme` itself. With the old symlink still in |
| 95 | place, HM can't create a file inside a symlinked-to-store directory and |
| 96 | activation fails outright. Remove this entry before your first |
| 97 | `home-manager switch`. |
| 98 | - `.gitconfig` (nix-combined's `programs.git` now owns this, with the |
| 99 | `filter.lfs` and `[sendemail]` sections merged in - they existed in |
| 100 | guix-dotfiles' `.gitconfig` but were missing from the old nix-dotfiles config) |
| 101 | - `.ssh/config` (same story - nix-combined's `programs.ssh.settings` is a |
| 102 | strict superset: added the `linode` host, the `192.168.216.1` |
| 103 | legacy-algorithm host, the `KexAlgorithms` exclusion on `Host *`, and the |
| 104 | `Match host * exec "gpg-connect-agent ..."` line) |
| 105 | - `.docker/cli-plugins` (docker-compose plugin - if you still want this, |
| 106 | it's cheap to add to `users/ryan/linux.nix`'s `home.file`; it wasn't |
| 107 | carried over because nothing else referenced it and I didn't want to |
| 108 | guess at whether you still use it) |
| 109 | |
| 110 | `hypr/Wallpapers` and the sway config were left alone deliberately - you said |
| 111 | you'd handle wallpapers yourself, and `sway` isn't referenced by anything |
| 112 | active (Hyprland is the real WM; see "Dead/unused" below). |
| 113 | |
| 114 | ## 3. Switch the login shell to zsh |
| 115 | |
| 116 | `guix-dotfiles/modules/ryan-config/base-system.scm`'s `base-operating-system` |
| 117 | has: |
| 118 | |
| 119 | ```scheme |
| 120 | ;(shell (file-append zsh "/bin/zsh")) |
| 121 | ``` |
| 122 | |
| 123 | commented out, so your account's login shell is still bash even though the |
| 124 | canonical config (nix-dotfiles, and now nix-combined) is zsh. Uncomment that |
| 125 | line (and rebuild/reconfigure the system) so `programs.zsh` in |
| 126 | `users/ryan/common.nix` is actually what runs on login. Until you do, bash |
| 127 | still runs (Guix's `home-bash-service-type` config, if still present, keeps |
| 128 | working - just don't remove it from `home-configuration.scm` until the shell |
| 129 | is actually switched, or you'll drop to a shell with no rc file at all). |
| 130 | |
| 131 | ## Stays in Guix - no home-manager equivalent without systemd |
| 132 | |
| 133 | Home-manager's `services.*` modules assume a systemd user session to |
| 134 | autostart things (or launchd on macOS). Guix uses shepherd instead, and |
| 135 | home-manager has no shepherd backend. These three keep running exactly as |
| 136 | they do today, defined in `guix-dotfiles/modules/ryan-services/`: |
| 137 | |
| 138 | - **`home-pipewire-service-type`** (pipewire + wireplumber daemons) |
| 139 | - **`home-dbus-service-type`** (per-user session dbus, since Guix has no |
| 140 | systemd --user to provide one) |
| 141 | - **`downloads-garbage-collector-service-type`** (the weekly Downloads |
| 142 | cleanup shepherd timer) |
| 143 | |
| 144 | `home-gpg-agent-service-type` is the one service that *did* migrate cleanly: |
| 145 | gpg-agent doesn't need a supervisor. It's socket-activated the same way on |
| 146 | both platforms via the zsh init in `common.nix` |
| 147 | (`gpgconf --launch gpg-agent` + exporting `SSH_AUTH_SOCK`), which is exactly |
| 148 | what nix-dotfiles' darwin config already did. `linux.nix` points |
| 149 | `services.gpg-agent.pinentry.package` at nixpkgs' `pinentry-qt` rather than |
| 150 | Guix's system profile path, so it isn't cross-dependent on Guix. |
| 151 | |
| 152 | `home-spotifyd-service-type` is already commented out/disabled in |
| 153 | `home-configuration.scm` - nothing to do there. |
| 154 | |
| 155 | ## Dead/unused - candidates to delete from guix-dotfiles |
| 156 | |
| 157 | Found while comparing the two repos; none of these are referenced by |
| 158 | anything active, so nothing carried them into nix-combined: |
| 159 | |
| 160 | - **fish** (`home-config/fish/`) - the `fish` package is commented out of |
| 161 | `home-configuration.scm`'s package list, but the dotfiles are still |
| 162 | checked in. Orphaned. |
| 163 | - **`.nix-channels`** - classic (non-flake) nix-channel file. Now that |
| 164 | everything is flake-based, this shouldn't be needed. |
| 165 | - **`icons/XCursor-Pro-Dark*`** - not referenced anywhere; only |
| 166 | `Bibata-Modern-*` appears in `hypr/hyprland.conf`. |
| 167 | - **`fonts/Fira Code`, `fonts/Lilex`, `fonts/Monofur For Powerline`, |
| 168 | `fonts/AnonymicePro`, `fonts/MonofurNerdFont`** - superseded by |
| 169 | `nerd-fonts.{fira-code,lilex,anonymice,monofur}` from nixpkgs |
| 170 | (`linux.nix`'s `home.packages`), which ship the same font families. |
| 171 | - **`home-spotifyd-service-type`** usage - already disabled. |
| 172 | - **`alacritty`** - config exists in both repos, but no package installs the |
| 173 | `alacritty` binary in either the guix or the old nix-home-manager config. |
| 174 | `foot` is what's actually wired into the system (Guix package list, |
| 175 | kmscon login). I added `pkgs.alacritty` to `linux.nix` so the config isn't |
| 176 | dead weight, but confirm whether you still use it - if not, drop both the |
| 177 | package and `users/ryan/linux/alacritty/`. |
| 178 | - **`sway` config** - not referenced by anything; Hyprland (via |
| 179 | home-manager) is the actual compositor in use. |
| 180 | |
| 181 | ## Additive merges (things nix-dotfiles was missing, now fixed) |
| 182 | |
| 183 | - **aerc**: `signature_personal`, `signature_rit_personal`, |
| 184 | `templates/quoted_reply`, `templates/thanks` existed only in |
| 185 | guix-dotfiles' aerc config, even though `accounts.conf`/`aerc.conf` |
| 186 | already referenced them by path. Copied into `users/ryan/aerc/`. |
| 187 | - **git**: `filter.lfs` and `[sendemail]` sections, merged into |
| 188 | `common.nix`'s `programs.git.settings`. |
| 189 | - **ssh**: `linode`, `192.168.216.1` (legacy host key/pubkey algorithms), |
| 190 | the `KexAlgorithms` exclusion, and the `Match host * exec ...` line, |
| 191 | merged into `common.nix`'s `programs.ssh`. |
| 192 | |
| 193 | ## Linux desktop stack re-pin (see also the flake-version conversation) |
| 194 | |
| 195 | The old `guix-dotfiles/home-config/nix-home-manager/flake.nix` pinned |
| 196 | home-manager to a 2024 commit specifically so it'd match separately-pinned |
| 197 | `hyprland`/`hyprlock`/`hyprpicker`/`wpaperd` flake inputs (plus a |
| 198 | `ryan77627/nixGL` fork and a `rust-overlay` pin for wpaperd). Sharing |
| 199 | `common.nix` with the darwin config (which tracks home-manager master) |
| 200 | required moving Linux onto the same nixpkgs/home-manager as darwin. |
| 201 | |
| 202 | The good news: current nixpkgs-unstable now packages `hyprland` (0.52.2), |
| 203 | `hyprlock`, `hypridle`, `hyprpicker`, `wpaperd`, `kanshi`, and `pyprland` |
| 204 | directly, so those five extra flake inputs (and the rust-overlay pin) are |
| 205 | gone entirely - `linux.nix` just uses `pkgs.hyprland` etc. Only two |
| 206 | Linux-specific flake inputs remain in `flake.nix`: |
| 207 | |
| 208 | - `nixgl` (still needed - it exists specifically to patch Guix's mesa/GL |
| 209 | mismatch, unrelated to nixpkgs version) |
| 210 | - `clipboard-sync` (not in nixpkgs) |
| 211 | |
| 212 | **Dropped**: the `hypr-dynamic-cursors` Hyprland plugin (animated cursor |
| 213 | trails). It has no nixpkgs package and pinning a matching flake input just |
| 214 | for one cosmetic plugin didn't seem worth the added re-pin risk. If you want |
| 215 | it back, add it as a flake input with `inputs.nixpkgs.follows = "nixpkgs"` |
| 216 | and pass it as a plugin in `wayland.windowManager.hyprland.plugins`. |
| 217 | |
| 218 | **Dropped**: `mozff` (firefox-nightly flake) - unused. The |
| 219 | `firefox-nightly` module's package line was already commented out in the |
| 220 | guix config; it just configures `programs.firefox` (nixpkgs' own package). |
| 221 | |
| 222 | **Cursor theme changed**: the vendored `Bibata-Modern-Classic-Hyprland` / |
| 223 | `Bibata-Modern-daed9-v1.0.2-x11` asset had oddly-versioned internal theme |
| 224 | names from however that release was originally packaged. Replaced with |
| 225 | nixpkgs' `bibata-cursors` (`home.pointerCursor` in `linux.nix`) - the |
| 226 | `HYPRCURSOR_THEME`/`XCURSOR_THEME` env vars in `hyprland.conf` were updated |
| 227 | to the plain name `Bibata-Modern-Classic` to match. nixpkgs' build doesn't |
| 228 | have a `-Hyprland`-suffixed hyprcursor variant; Hyprland falls back to |
| 229 | rendering the XCursor theme directly, which works fine, just without the |
| 230 | optional cleaner hyprcursor rendering path. |
| 231 | |
| 232 | ## Verification note |
| 233 | |
| 234 | `homeConfigurations.ryan` was checked with: |
| 235 | |
| 236 | ``` |
| 237 | nix eval --raw .#homeConfigurations.ryan.activationPackage.drvPath |
| 238 | ``` |
| 239 | |
| 240 | which forces full module evaluation (catches missing options and |
| 241 | darwin-only packages referenced on Linux) without building anything. |
| 242 | |
| 243 | `darwinConfigurations.RyanMac` could not be evaluated on this machine (no |
| 244 | aarch64-darwin builder). It was verified by structural diff instead: |
| 245 | `flake.nix`'s darwin-facing inputs/outputs, `hosts/RyanMac/configuration.nix`, |
| 246 | and `modules/darwin/random-wallpaper` are unchanged from `nix-dotfiles`; |
| 247 | `common.nix`/`darwin.nix` reproduce `nix-dotfiles/users/ryan/home.nix` |
| 248 | line-for-line except where noted above. Please run |
| 249 | `darwin-rebuild build --flake .#RyanMac` yourself before switching for real. |