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/home.nix | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 remote-dev/home.nix (limited to 'remote-dev/home.nix') diff --git a/remote-dev/home.nix b/remote-dev/home.nix new file mode 100644 index 0000000..a2b9392 --- /dev/null +++ b/remote-dev/home.nix @@ -0,0 +1,106 @@ +{ config, pkgs, lib, dotfilesRoot, ... }: + +let + # The dotfiles checkout is cloned to ~/.local/share/dotfiles by bootstrap.sh. + # We do NOT use `dotfilesRoot` as a Nix store path because that would copy + # the entire repo into the store on every rebuild. Instead, we symlink + # config dirs at runtime via `config.lib.file.mkOutOfStoreSymlink`, which + # points at the live working tree so edits take effect without a rebuild. + dotfiles = "${config.home.homeDirectory}/.local/share/dotfiles"; + link = path: config.lib.file.mkOutOfStoreSymlink "${dotfiles}/${path}"; +in +{ + home.username = builtins.getEnv "USER"; + home.homeDirectory = builtins.getEnv "HOME"; + home.stateVersion = "25.05"; + + # ── Packages ──────────────────────────────────────────────────────────────── + # Mirrors the dev-tool subset of `meta/base.txt` on the Arch host. Tools that + # only make sense on a workstation (procs/gdu/duf for sysadmin, lazygit + # unused, node/yarn only needed for markdown-preview on GUI) are excluded. + home.packages = with pkgs; [ + # Editor + multiplexer + neovim + zellij + tree-sitter + + # Search / move + ripgrep + fd + fzf + sd + choose + + # Viewers + bat + lsd + glow + + # Git stack + git + gh + delta + + # JSON / YAML + jq + yq-go + + # System + htop + fastfetch + + # Net + curl + curlie + wget + dog + rsync + openssh + + # Docs + tldr + man-db + man-pages + + # Secrets (user can bring their key separately) + gnupg + pass + + # Zsh and plugins (sourced from $HOME/.nix-profile/share/... by the shared zshrc) + zsh + zsh-syntax-highlighting + zsh-autosuggestions + zsh-history-substring-search + ]; + + # ── direnv + nix-direnv ───────────────────────────────────────────────────── + programs.direnv = { + enable = true; + nix-direnv.enable = true; + enableZshIntegration = false; # zshrc already calls `eval "$(direnv hook zsh)"` + }; + + # ── Shared config symlinks ────────────────────────────────────────────────── + # Live symlinks back into the cloned working tree so `git pull` is enough + # to update configs — no `home-manager switch` required after every edit. + xdg.configFile = { + "nvim".source = link "dot_config/nvim"; + "zellij".source = link "dot_config/zellij"; + "zsh/.zshrc".source = link "dot_config/zsh/dot_zshrc"; + "zsh/.zprofile".source = link "dot_config/zsh/dot_zprofile"; + "ghostty".source = link "dot_config/ghostty"; # for terminfo refs only + "direnv/direnvrc".source = link "dot_config/direnv/direnvrc"; + }; + + # ZDOTDIR redirect so login shells find ~/.config/zsh/.zprofile etc. + home.file.".zshenv".text = '' + export ZDOTDIR="$HOME/.config/zsh" + [[ -r "$ZDOTDIR/.zshenv" ]] && source "$ZDOTDIR/.zshenv" + ''; + + # ── XDG base dirs (Ubuntu doesn't set these in /etc/profile.d by default) ── + xdg.enable = true; + + # ── Enable HM-managed activation messages ────────────────────────────────── + programs.home-manager.enable = true; +} -- cgit v1.3.1