New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wrapFish: add fish shell wrapper package #108491
Conversation
This adds a wrapper for fish which allows creating shells pre-initialised with some completions, functions, and configuration scripts from given paths or from fish plugin packages (`pkgs.fishPlugins.*`). This is especially handy when one wants to try a plugin in an ephemeral shell. GitHub: see NixOS#107834 (comment)
1c87fd9
to
5daa170
Compare
@rnhmjoj Documentation added. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we also want to define a fish-unwrapped
package and redefine fish = wrapFish fish-unwrapped { };
as we do with e.g. neovim
? Right now, I don't think there's much point, but in the future it might be more beneficial (and e.g. we might want to get this in at the same time we introduce the wrapper).
5daa170
to
165937d
Compare
@cole-h wrote:
I don't see any use case currently either. I think this would be prone to breakage since we would mess-up with environment initialisation, so I think that a proper, separate pull request would be needed to get that done properly. The standalone wrapper is nevertheless still useful both for maintainers and users who might want to test plugins. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Diff LGTM, I don't see anything obviously wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Thank you for the documentation!
${fish}/bin/fish --init-command " | ||
set --prepend fish_complete_path ${escapeShellArgs complPath} | ||
set --prepend fish_function_path ${escapeShellArgs funcPath} | ||
for c in {${concatStringsSep "," safeConfPath}}/*; source $c; end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pacien I've just discovered an issue with this line.
When safeConfPath
only contains a single element, due to some peculiarity w/ brace expansion in fish [1], the expansion will produce a single value of just that single element wrapped into braces, which in turn will result in a silent failure since that path will not actually exist in the file system.
e.g. if safeConfPath just contains foo
, that line produce something like for c in '{foo}/*'; source $c; end
which will silently fail, and the corresponding scripts won't be sourced.
Not sure how to fix this. May add a dummy path in the brace force proper expansion?
[1] http://fishshell.com/docs/current/index.html#expand-brace # see examples in the second code block
This fixes the expansion of the configuration path in the pathological case of a singleton, which would otherwise be used verbatim with the surrounding braces for lookup. GitHub: see #108491 (review)
Motivation for this change
This adds a wrapper for fish which allows creating shells pre-initialised
with some completions, functions, and configuration scripts from given paths
or from fish plugin packages (
pkgs.fishPlugins.*
).This is especially handy when one wants to try a plugin in an ephemeral shell.
GitHub: see #107834 (comment)
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)CC
CC @rnhmjoj