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. --- dot_config/zsh/dot_zshrc | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'dot_config/zsh') diff --git a/dot_config/zsh/dot_zshrc b/dot_config/zsh/dot_zshrc index 552f9eb..7a9538d 100644 --- a/dot_config/zsh/dot_zshrc +++ b/dot_config/zsh/dot_zshrc @@ -31,7 +31,13 @@ bindkey -e # ── Prompt ──────────────────────────────────────────────────────────────────── autoload -Uz colors && colors -source /usr/share/git/completion/git-prompt.sh +# git-prompt.sh: distro-managed on Arch, nix-store-managed on the VM +for _f in \ + /usr/share/git/completion/git-prompt.sh \ + $HOME/.nix-profile/share/git/contrib/completion/git-prompt.sh; do + [[ -r $_f ]] && { source "$_f"; break; } +done +unset _f PROMPT='%B%{$fg[green]%}%n%{$reset_color%}@%{$fg[cyan]%}%m%{$reset_color%}:%b%{$fg[yellow]%}%~%{$reset_color%}$(__git_ps1 " (%s)")%(?..[%{$fg[red]%}%?%{$reset_color%}]) %(!.#.>) ' # ── Completion ──────────────────────────────────────────────────────────────── @@ -375,15 +381,32 @@ _fzf_compgen_path() { fd --hidden --follow --exclude ".git" . "$1" } _fzf_compgen_dir() { fd --type d --hidden --follow --exclude ".git" . "$1" } # ── Plugins (must be sourced last) ──────────────────────────────────────────── +# Plugin locations: Arch system path first, ~/.nix-profile fallback for VM HM. +_source_first() { + local f + for f in "$@"; do + [[ -r $f ]] && { source "$f"; return 0; } + done + return 1 +} + # Highlight config must be set BEFORE sourcing the plugin ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern) typeset -A ZSH_HIGHLIGHT_STYLES ZSH_HIGHLIGHT_STYLES[comment]='fg=yellow' -source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh +_source_first \ + /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh \ + $HOME/.nix-profile/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh -source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh +_source_first \ + /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh \ + $HOME/.nix-profile/share/zsh-autosuggestions/zsh-autosuggestions.zsh bindkey '^[[Z' autosuggest-accept # Shift-Tab to accept suggestion -source /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh +_source_first \ + /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh \ + $HOME/.nix-profile/share/zsh-history-substring-search/zsh-history-substring-search.zsh [[ -n "${key[Up]}" ]] && bindkey -- "${key[Up]}" history-substring-search-up [[ -n "${key[Down]}" ]] && bindkey -- "${key[Down]}" history-substring-search-down + +unfunction _source_first -- cgit v1.3.1