Fish is unable to open universal variable file

I upgraded my system from 2.24.11 to 2.28.3 and now every time I do anything in the Fish shell I get these error messages over and over:

“error: Unable to open universal variable file ‘/home/axelcool1234/.config/fish/fish_variables’: EACCES: Permission denied”

Fish is managed by home-manager. My config for fish is symlinked with home-manager (I use “xdg.configFile.fish.source = ./fish;”).

I’m unsure what changed between versions. I couldn’t seem to find anyone else online with this problem.

What are the perms on that file?

You can’t do that.

From what I understand, fish wants the universal variables file to be writeable.

This is unrelated to your nix version.

Either you use recursive = true to still get folders where fish can do stuff in an otherwise unmanaged universal variables file, or you disable universal variables in fish (if this is actually possible).

1 Like

I don’t think it is possible.

With the following code, I still receive the same error:

xdg.configFile.fish = {
    source = ./fish;
    recursive = true;
};

I have read online that fish_variables is stateful and Fish treats it as such, but it was never a problem until I updated. I haven’t seen anyone with this problem online though (the amount of times I’ve found a solution to my problem by searching through this forum is very very high - assuming my problem gets fixed here, I hope someone in the future will benefit from this), so I assume I’m doing something wrong or silly. Thanks for bearing with me here.

With the recursive = true suggestion, the perms on the symlink is lrwxrwxrwx with the owner being axelcool1234. If I follow the symlinks to the source file in /nix/store, the perms of fish_variables is -r--r--r-- with the owner being root.

Without the recursive = true suggestion, the perms of the (non-symlink) file in .config/fish is similarly -r--r--r-- with the owner being root.

It shouldn’t be a symlink! HM must not manage the universal variables file, as I already wrote in my first post.

I.e., move the fish_variables file out of ./fish and then copy it to the config dir manually after a rebuild switch. It must be recursive for this to be possible, since otherwise the config root is in the nix store and immutable.

It’d be interesting to investigate what changed, sounds like your configuration may not have been evaluating correctly until now.

1 Like

I see. I apologize NobbZ, I misread what you were saying. Interestingly, when I switched to my old generation, I received those errors if I entered fish into my terminal and entered a new session, but the initial session that occurs when I open a terminal lacks any of those errors. Strange. Although I don’t recall this happening before, so it could just be due to my system already being updated, since starting NixOS in an old generation isn’t a complete context switch after an update I think.

After making ./fish managed recursively, I copied fish_variables manually into .config/fish and now Fish has write access. It’s unfortunate I can’t have this file managed by Nix or Home Manager. But I appreciate even a manual solution here, thanks.

If you’re interested, I’m more than willing to investigate but I wouldn’t even know what to look for.

It is for everything defined by the configuration, but nix deployments never change state. It’s possible some state changed that fish now tries to write to that file when it previously did not. It’s likely unrelated to your update.

I would have started by loading up a previous generation, but you’ve already done so. I don’t know fish well enough to suggest anything else.

1 Like