|
23 | 23 | fzf |
24 | 24 | zoxide |
25 | 25 | direnv |
| 26 | + gitleaks |
| 27 | + pre-commit |
26 | 28 | nodejs_22 |
27 | 29 | mkcert |
28 | 30 | cmake |
|
39 | 41 | # atomically when a real `docker completion zsh` is available. |
40 | 42 | home.file = { |
41 | 43 | ".local/share/zsh/site-functions/_docker".text = '' |
42 | | -# Home Manager managed stub for docker completion |
43 | | -# If the real Docker CLI is available the runtime updater will replace this |
44 | | -# file with the full completion script; this stub gives a minimal useful |
45 | | -# fallback to avoid missing completion errors. |
46 | | -_docker() { |
47 | | - compadd build run compose ps images pull push exec logs start stop rm rmi |
48 | | -} |
49 | | -compdef _docker docker |
50 | | -''; |
| 44 | + # Home Manager managed stub for docker completion |
| 45 | + # If the real Docker CLI is available the runtime updater will replace this |
| 46 | + # file with the full completion script; this stub gives a minimal useful |
| 47 | + # fallback to avoid missing completion errors. |
| 48 | + _docker() { |
| 49 | + compadd build run compose ps images pull push exec logs start stop rm rmi |
| 50 | + } |
| 51 | + compdef _docker docker |
| 52 | + ''; |
| 53 | + ".zshenv".text = '' |
| 54 | + # Prepend the user site-functions directory to fpath early so compinit can |
| 55 | + # autoload completions managed by Home Manager (e.g. _docker). This runs for |
| 56 | + # all zsh shells before other init files. |
| 57 | + fpath=("$HOME/.local/share/zsh/site-functions" $fpath) |
| 58 | + ''; |
51 | 59 | }; |
52 | 60 |
|
53 | 61 |
|
@@ -117,12 +125,20 @@ compdef _docker docker |
117 | 125 | # only when different. This avoids slowing every shell startup and |
118 | 126 | # keeps the activation-time managed stub as the authoritative source. |
119 | 127 | if command -v docker >/dev/null 2>&1; then |
120 | | - TMPFILE="$ZSH_SITE_FUNCS/_docker.tmp" |
121 | | - if docker completion zsh > "$TMPFILE" 2>/dev/null; then |
122 | | - if [ ! -f "$ZSH_SITE_FUNCS/_docker" ] || ! cmp -s "$TMPFILE" "$ZSH_SITE_FUNCS/_docker"; then |
123 | | - mv "$TMPFILE" "$ZSH_SITE_FUNCS/_docker" |
124 | | - else |
125 | | - rm -f "$TMPFILE" |
| 128 | + # If the completion file is a symlink (managed by home-manager/Nix), |
| 129 | + # don't try to overwrite it from shell startup — that can trigger an |
| 130 | + # interactive "override" prompt. Only update when the target is a |
| 131 | + # regular file owned/writable by the user. |
| 132 | + if [ -L "$ZSH_SITE_FUNCS/_docker" ]; then |
| 133 | + : # skip updater for home-managed symlink |
| 134 | + else |
| 135 | + TMPFILE="$ZSH_SITE_FUNCS/_docker.tmp" |
| 136 | + if docker completion zsh > "$TMPFILE" 2>/dev/null; then |
| 137 | + if [ ! -f "$ZSH_SITE_FUNCS/_docker" ] || ! cmp -s "$TMPFILE" "$ZSH_SITE_FUNCS/_docker"; then |
| 138 | + mv -f "$TMPFILE" "$ZSH_SITE_FUNCS/_docker" |
| 139 | + else |
| 140 | + rm -f "$TMPFILE" |
| 141 | + fi |
126 | 142 | fi |
127 | 143 | fi |
128 | 144 | fi |
|
0 commit comments