You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The normal behaviour for Fish (on other systems) is to read a file /etc/fish/functions/foo.fish when calling a function foo. But when I place a file there to define a function, it is not read.
This bug is currently blocking #377595 from working properly.
Steps to reproduce
Define a file /etc/fish/functions/foo.fish with contents:
function foo
echo "Hellorld!"
end
Then, on the Fish prompt, type foo.
Expected behaviour
Hellorld! is printed.
Screenshots
No response
Relevant log output
Additional context
The $fish_function_path is supposed to define all the directories that Fish should search for functions. On my NixOS system it includes:
/home/rua/.config/fish/functions (the usual search path for user-specific user-defined functions)
/nix/store/baax6xdshr2sx05hfshc0szi86ck3k0z-fish-3.7.1/share/fish/functions (for functions that are supplied with the package)
I have a feeling that /nix/store/baax6xdshr2sx05hfshc0szi86ck3k0z-fish-3.7.1/etc/fish/functions does not belong there, and ought to be /etc/fish/functions instead. /etc is meant for user-defined configurations, so including it as part of a Nix store output seems contradictory. Note also that the module https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/programs/fish.nix creates the file /etc/fish/config.fish, so it is strange that that file is read, but /etc/fish/functions/*.fish are not.
System metadata
system: "x86_64-linux"
host os: Linux 6.6.72, NixOS, 24.11 (Vicuna), 24.11.20250126.4e96537
I have a feeling that /nix/store/baax6xdshr2sx05hfshc0szi86ck3k0z-fish-3.7.1/etc/fish/functions does not belong there, and ought to be /etc/fish/functions instead. /etc is meant for user-defined configurations, so including it as part of a Nix store output seems contradictory.
/nix/store/*-fish-3.7.1/etc/fish/functions would be the functions which shipped with fish itself, so it makes sense to have the directory in the search path (though it's currently empty on nixos-unstable)
To add things to /run/current-system/sw/etc, they need to be (in a derivation which is) added to environment.systemPackages rather than environment.etc; I'll suggest a change in the o.g. PR.
Regarding whether /etc/fish/functions should be added to the search path, I'll leave that to the fish maintainers.
PS: Note that /etc/fish/*.fish seems to be used, so using /etc/fish/functions would be consistent.
/nix/store/*-fish-3.7.1/etc/fish/functions would be the functions which shipped with fish itself, so it makes sense to have the directory in the search path (though it's currently empty on nixos-unstable)
According to Fish's documentation, functions shipped with Fish should go in /usr/share/fish/functions.
Nixpkgs version
Describe the bug
The normal behaviour for Fish (on other systems) is to read a file
/etc/fish/functions/foo.fish
when calling a functionfoo
. But when I place a file there to define a function, it is not read.This bug is currently blocking #377595 from working properly.
Steps to reproduce
Define a file
/etc/fish/functions/foo.fish
with contents:Then, on the Fish prompt, type
foo
.Expected behaviour
Hellorld!
is printed.Screenshots
No response
Relevant log output
Additional context
The
$fish_function_path
is supposed to define all the directories that Fish should search for functions. On my NixOS system it includes:/home/rua/.config/fish/functions
(the usual search path for user-specific user-defined functions)/nix/store/baax6xdshr2sx05hfshc0szi86ck3k0z-fish-3.7.1/etc/fish/functions
vendor_functions.d
locations/home/rua/.nix-profile/etc/fish/functions
and/home/rua/.local/state/nix/profile/etc/fish/functions
/nix/profile/etc/fish/functions
/etc/profiles/per-user/rua/etc/fish/functions
/nix/var/nix/profiles/default/etc/fish/functions
/run/current-system/sw/etc/fish/functions
/nix/store/baax6xdshr2sx05hfshc0szi86ck3k0z-fish-3.7.1/share/fish/functions
(for functions that are supplied with the package)I have a feeling that
/nix/store/baax6xdshr2sx05hfshc0szi86ck3k0z-fish-3.7.1/etc/fish/functions
does not belong there, and ought to be/etc/fish/functions
instead./etc
is meant for user-defined configurations, so including it as part of a Nix store output seems contradictory. Note also that the module https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/programs/fish.nix creates the file/etc/fish/config.fish
, so it is strange that that file is read, but/etc/fish/functions/*.fish
are not.System metadata
"x86_64-linux"
Linux 6.6.72, NixOS, 24.11 (Vicuna), 24.11.20250126.4e96537
yes
yes
nix-env (Nix) 2.24.11
/nix/store/50yickar04m51aqnc43gxf45g2i0n3k9-source
Notify maintainers
@adamcstephens @cole-h @winterqt
Note for maintainers: Please tag this issue in your pull request description. (i.e.
Resolves #ISSUE
.)I assert that this issue is relevant for Nixpkgs
Is this issue important to you?
Add a 👍 reaction to issues you find important.
The text was updated successfully, but these errors were encountered: