feat(fish): Add foreign env var plugin for fish

This commit is contained in:
ulic-youthlic 2025-09-17 00:25:17 +08:00
parent 045fa32698
commit 38163983b1
Signed by: youthlic
GPG key ID: 63E86C3C14A0D721

View file

@ -1,6 +1,7 @@
{ {
config, config,
lib, lib,
pkgs,
... ...
}: }:
let let
@ -20,6 +21,17 @@ in
interactiveShellInit = '' interactiveShellInit = ''
fish_vi_key_bindings fish_vi_key_bindings
''; '';
plugins = [
{
name = with pkgs.fishPlugins.foreign-env; pname + "-" + version;
src = pkgs.fishPlugins.foreign-env.overrideAttrs {
postInstall = # bash
''
ln -s $out/share/fish/vendor_functions.d $out/functions
'';
};
}
];
functions = { functions = {
__fish_command_not_found_handler = { __fish_command_not_found_handler = {
body = "__fish_default_command_not_found_handler $argv[1]"; body = "__fish_default_command_not_found_handler $argv[1]";
@ -31,6 +43,18 @@ in
''; '';
}; };
}; };
shellInitLast = # fish
''
if test -d ~/.guix-profile
set -gx GUIX_PROFILE ~/.guix-profile
if test -f $GUIX_PROFILE/etc/profile
fenv source $GUIX_PROFILE/etc/profile
end
if test -d $GUIX_PROFILE/lib/locale
set -gx GUIX_LOCPATH $GUIX_PROFILE/lib/locale
end
end
'';
}; };
fastfetch.enable = true; fastfetch.enable = true;
}; };