From 60cd24cecc400d4381f5e6243940b5d0e760e4f9 Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Wed, 13 May 2026 13:43:42 +0100 Subject: feat(remote-dev): add Nix Home-Manager flake for Ubuntu 22 VM dev env New remote-dev/ subdir with a Home-Manager flake that provisions a headless dev environment on a remote Ubuntu 22.04 VM accessed via SSH. Shares nvim, zellij, zsh, direnv, and ghostty configs from the same dotfiles repo via mkOutOfStoreSymlink (no rebuilds on config edits). CLI tool set mirrors the dev-tool subset of meta/base.txt; sysadmin tools (procs, gdu, duf), lazygit, and node/yarn (only needed for markdown-preview on GUI hosts) are excluded. bootstrap.sh is one-shot: installs Nix via Determinate Systems installer, clones the repo to ~/.local/share/dotfiles, runs home-manager switch, and chshes to the nix-store zsh. dot_config/zsh/dot_zshrc loses its hardcoded Arch plugin/git-prompt paths in favour of a fallback search: Arch path first, then $HOME/.nix-profile/share/. Same file works on host and VM. .chezmoiignore: exclude remote-dev/ from chezmoi deploy on the host. --- remote-dev/README.md | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 remote-dev/README.md (limited to 'remote-dev/README.md') diff --git a/remote-dev/README.md b/remote-dev/README.md new file mode 100644 index 0000000..a274d19 --- /dev/null +++ b/remote-dev/README.md @@ -0,0 +1,69 @@ +# remote-dev + +Headless dev environment for an Ubuntu 22.04 VM I SSH into. Deployed with +Nix + Home-Manager. Shares the host's neovim, zellij, and zsh configs from +the same repo — no duplication. + +## Bootstrap + +On a fresh VM, as the dev user (must have sudo): + +```sh +curl -fsSL https://raw.githubusercontent.com/ruifm/dotfiles/master/remote-dev/bootstrap.sh | sh +``` + +Then log out and back in. Run `nvim` once to let it fetch plugins from +GitHub on first launch. + +## What it does + +1. Installs Nix (Determinate Systems multi-user installer). +2. Clones this repo to `~/.local/share/dotfiles`. +3. Runs `home-manager switch --flake .../remote-dev#vm`, which: + - Installs the CLI tool subset (see `home.nix`). + - Symlinks `~/.config/{nvim,zellij,zsh,direnv,ghostty}` at the cloned + working tree via `mkOutOfStoreSymlink`, so `git pull` is enough to + pick up config edits — no rebuild needed for config-only changes. + - Sets `ZDOTDIR=$HOME/.config/zsh` so the shared zshrc/zprofile load. +4. Appends the nix-store zsh to `/etc/shells` and `chsh`'s to it. + +## Updating + +```sh +cd ~/.local/share/dotfiles +git pull +nix run home-manager/master -- switch --flake ./remote-dev#vm +``` + +## Adding a tool + +Edit `home.nix`, add to `home.packages`, then `home-manager switch`. + +## Caveats + +- **GPG / pass**: HM installs `gnupg` and `pass` but does _not_ import any + private key. Bring your key separately if you need signed commits or + `pass`-backed env vars on the VM. +- **Disk usage**: Nix store + nvim plugins consumes ~3-5 GB. Check the + VM's root partition size first. +- **Network for first nvim launch**: `vim.pack.add` fetches plugins from + GitHub on first start. +- **Ubuntu apt collisions**: Nix-installed binaries appear first in PATH. + If you need a specific apt-version of something, install it manually + and prefix with the full path. + +## How it's wired + +`home.nix` uses `config.lib.file.mkOutOfStoreSymlink` so the symlinks +point at the **live working tree** at `~/.local/share/dotfiles/...`, not +at copies in `/nix/store`. This means: + +- Editing `dot_config/nvim/init.lua` in the cloned repo takes effect on + the next `nvim` launch with no rebuild. +- `home-manager switch` only needs to re-run when adding/removing a + package or changing what's symlinked. + +The zsh plugins (`zsh-syntax-highlighting`, etc.) live in +`$HOME/.nix-profile/share/`. The shared `dot_zshrc` probes Arch system +paths first, then falls back to the nix-profile path, so the same file +works on both host and VM unchanged. -- cgit v1.3.1