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 support assumes a particular sysconfdir #576

Open
therealpxc opened this issue Jul 17, 2023 · 1 comment
Open

Fish support assumes a particular sysconfdir #576

therealpxc opened this issue Jul 17, 2023 · 1 comment

Comments

@therealpxc
Copy link

therealpxc commented Jul 17, 2023

I noticed the fish self-test failing when I installed Nix via this installer from Fish on my Mac. After some investigation, I figured out that this is because this installer sets up Nix paths on Fish by placing a file in /etc/fish/conf.d-- what fish calls the sysconfdir. But sysconfdir is actually determined by the prefix Nix is installed to.

Consequently, when the config file that the Determinate Nix Installer creates for fish is never read when fish is installed from pkgsrc (where sysconfdir is /opt/pkg/etc/fish) or Nix (where sysconfdir is /nix/store/<hash>-fish/etc/fish). In the Nix case, this is a Nixpkgs bug: the useOperatingSystemEtc argument to the Fish package should create a hook in the hardcoded sysconfdir that loads conf.d snippets from /etc/fish as well, but it doesn't.

The correct sysconfdir path for a given fish installation can be found in the built-in fish variable __fish_sysconf_dir, i.e.:

$ /opt/pkg/bin/fish -c 'echo $__fish_sysconf_dir'
/opt/pkg/etc/fish
$ /nix/var/nix/profiles/default/bin/fish -c 'echo $__fish_sysconf_dir'
/nix/store/5lslk9msx2zqzxnwny2mdfgnsff3b35i-fish-3.6.1/etc/fish

To reiterate what is implied here, this means that even if we detect the sysconfdir correctly, we can't assume that it is writable, because it isn't in the Nix case!

You can check what config files fish reads on startup without as much noise as strace with:

fish --debug config -c exit

There are some additional concerns about sourcing and ordering to think about, but they span across installers and module systems so I'll be starting a new topic on NixOS Discourse about it soon.

@therealpxc
Copy link
Author

filed a Nixpkgs issue here: NixOS/nixpkgs#244043

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant