Skip to content
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

fish: Files in /etc/fish/functions are not read #377948

Open
3 tasks done
Rua opened this issue Jan 30, 2025 · 2 comments
Open
3 tasks done

fish: Files in /etc/fish/functions are not read #377948

Rua opened this issue Jan 30, 2025 · 2 comments
Labels
0.kind: bug Something is broken

Comments

@Rua
Copy link

Rua commented Jan 30, 2025

Nixpkgs version

  • Stable (24.11)

Describe the bug

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/etc/fish/functions
  • Lots of vendor_functions.d locations
  • Flatpak-specific locations
  • Profile-specific 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

  • system: "x86_64-linux"
  • host os: Linux 6.6.72, NixOS, 24.11 (Vicuna), 24.11.20250126.4e96537
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.24.11
  • nixpkgs: /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.

@Rua Rua added the 0.kind: bug Something is broken label Jan 30, 2025
@nbraud
Copy link
Contributor

nbraud commented Jan 30, 2025

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.

@Rua
Copy link
Author

Rua commented Jan 30, 2025

/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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

No branches or pull requests

2 participants