From 95869fb11f9095ec99d6701b5c097ae4b4297e20 Mon Sep 17 00:00:00 2001 From: alexion Date: Sat, 18 Jul 2026 18:56:07 -0400 Subject: [PATCH] refactor(fish): assemble the interactive init in Nix, not at runtime Fold the done plugin tuning back into config.fish and drop the conf.d fragment: config.fish is read whole into interactiveShellInit, so Nix assembles the interactive init at build time instead of fish autoloading a separate conf.d file. functions/copy.fish stays a function file, the idiomatic home for a lazily-autoloaded function. --- .claude/tasks/0005-fish-shell-module.md | 2 +- modules/fish/conf.d/done.fish | 3 --- modules/fish/config.fish | 4 ++++ modules/fish/fish.nix | 3 --- 4 files changed, 5 insertions(+), 7 deletions(-) delete mode 100644 modules/fish/conf.d/done.fish diff --git a/.claude/tasks/0005-fish-shell-module.md b/.claude/tasks/0005-fish-shell-module.md index 136ac72..6bf2c20 100644 --- a/.claude/tasks/0005-fish-shell-module.md +++ b/.claude/tasks/0005-fish-shell-module.md @@ -39,4 +39,4 @@ Configure the plugins natively through home-manager rather than a fish plugin ma - **Abbreviation-first.** Every non-eza alias is now a `shellAbbr` (the eza `ls` family stays an alias), `preferAbbrs = true`, and `generateCompletions = true` is pinned rather than left to the upstream default. - **vi command-line editing.** `interactiveShellInit` sets `fish_key_bindings fish_vi_key_bindings`; the `bang-bang` plugin re-binds `!`/`$` in insert mode via its own `--on-variable fish_key_bindings` handler, so the switch keeps them working. - **Trimmed aliases.** Navigation capped at four dots (`.....`/`......` dropped); `psmem`, `psmem10`, `dir`, `vdir`, and `please` removed. -- **Module directory mirrors `~/.config/fish/`.** The Module lives at `modules/fish/fish.nix` with its hand-written fish laid out as in a real fish config: `config.fish` (interactive init, read into `interactiveShellInit`), `conf.d/done.fish` (the done plugin's tuning, placed as a real conf.d file via `xdg.configFile`), and `functions/copy.fish` (the non-trivial `copy` body, read into the `functions` option). Trivial one-liner functions stay inline in `fish.nix`. `completions/` and `themes/` are omitted because they have no content and git cannot track empty directories. The Auto-loader only collects `.nix`, so every `.fish` file is inert to it. +- **Module directory mirrors `~/.config/fish/`.** The Module lives at `modules/fish/fish.nix` with its hand-written fish laid out as in a real fish config: `config.fish` (the whole interactive init, read into `interactiveShellInit`) and `functions/copy.fish` (the non-trivial `copy` body, read into the `functions` option). Trivial one-liner functions stay inline in `fish.nix`. Everything Nix assembles at build time — nothing of ours is autoloaded from a separate runtime file — so the `done` plugin tuning stays inside `config.fish` rather than a `conf.d` fragment (`conf.d` would only earn its name if fish autoloaded it at runtime). `functions/copy.fish` is the sole exception, because fish autoloads function files lazily and that is the idiomatic home for a function. `completions/`/`themes/`/`conf.d/` are omitted as they hold no content of ours and git cannot track empty directories. The Auto-loader only collects `.nix`, so every `.fish` file is inert to it. diff --git a/modules/fish/conf.d/done.fish b/modules/fish/conf.d/done.fish deleted file mode 100644 index ff0e81e..0000000 --- a/modules/fish/conf.d/done.fish +++ /dev/null @@ -1,3 +0,0 @@ -# Tune the done plugin: only notify for commands past 10s, at low urgency. -set -g __done_min_cmd_duration 10000 -set -g __done_notification_urgency_level low diff --git a/modules/fish/config.fish b/modules/fish/config.fish index ceb444a..08d8b9e 100644 --- a/modules/fish/config.fish +++ b/modules/fish/config.fish @@ -8,6 +8,10 @@ set -gx VISUAL nvim set -x MANROFFOPT "-c" set -x MANPAGER "sh -c 'col -bx | bat -l man -p'" +# Tune the done plugin: only notify for commands past 10s, at low urgency. +set -g __done_min_cmd_duration 10000 +set -g __done_notification_urgency_level low + # Prepend ~/.local/bin to PATH when it exists. if test -d ~/.local/bin fish_add_path ~/.local/bin diff --git a/modules/fish/fish.nix b/modules/fish/fish.nix index 535c39b..4a73897 100644 --- a/modules/fish/fish.nix +++ b/modules/fish/fish.nix @@ -37,9 +37,6 @@ in wget # non-interactive HTTP downloader; backs the wget abbreviation ]; - # done's tuning lives in its own conf.d snippet, mirroring ~/.config/fish. - xdg.configFile."fish/conf.d/done.fish".source = ./conf.d/done.fish; - programs.fish = { enable = true;