Open grahamc opened 2 years ago
Graham and I talked about this a little bit, and one potential solution (just brainstorming, really; functionality or lack thereof may make it a nonstarter) might be to make $__fish_sysconf_dir/conf.d
a symlink to /etc/fish/conf.d
EDIT: whether it exists or not.
So this may be a totally... bad idea, but something I came up with is dynamically setting the sysconf dir based on what exists. What this would look like in practice is a wrapper that goes through a list of potential sysconf dirs (sorted by priority), and when one exists, setting the environment variable to that (and caching using a separate environment variable) -- or just setting it if it's unset.
This isn't currently possible since Fish would override the sysconf directory on startup, but with a one line patch we can disable this.
Thoughts welcome, I'd be happy to implement this if we agree to move forward with it :)
Graham and I talked about this a little bit, and one potential solution (just brainstorming, really; functionality or lack thereof may make it a nonstarter) might be to make
$__fish_sysconf_dir/conf.d
a symlink to/etc/fish/conf.d
.
Do you mean just setting the sysconf directory to Oh, I see what you mean -- making the store path a symlink./etc/fish
? (Don't see how symlinks would come into play.)
Wouldn't this break "backwards" compatibility (moving from a non-Nixpkgs Fish to Nixpkgs Fish without having to move stuff around), though? Furthermore, how would /etc/fish
be created -- wouldn't it have to be created and owned by root? Maybe Fish handles this already, I'll look into it.
Describe the bug
Our Fish has a Nix store path set as its sysconfig dir:
this directory has a config.fish which loads /etc/fish/config.fish. However, Fish has conf.d support to allow other vendors to ship snippets that also get loaded: https://fishshell.com/docs/current/language.html?highlight=__fish_sysconf_dir#configuration-files
Because we set the sysconf dir to the Nix store, this behavior is broken.
Furthermore, software may run fish to ask where its sysconf directory is, which is also broken since that location is read only:
I'm looking at supporting Fish in the Nix installer, and it appears that using a Nix-provided Fish shell breaks the Nix installation. The part about querying where the sysconf dir is especially painful, because basically every packaging for Fish on a Mac puts it somewhere else:
Expected behavior
Fish's conf.d support loads.
Notify maintainers
@cole-h @rapenne-s @winterqt
"x86_64-linux"
Linux 5.15.58, NixOS, 22.11 (Raccoon)
yes
yes
nix-env (Nix) 2.10.3
"nixos-21.05pre282015.a73020b2a15"
/nix/var/nix/profiles/per-user/root/channels/nixos