How is the state of nix support for fish shell?

Some time ago I tried to install nix on a macOS Catalina using fish shell and it was not a pleasant experience. In the end, I just gave up because the setup was way too hacky for me.

I’m wondering if this has improved because I would really like to give nix a second try.

2 Likes

What kind of support do you expect?

fish is available to install and if you want to use home-manager, then it also has a couple of options to configure fish.

Sorry about that, I was not clear at my question. My concern is about the installation. For example, following the official installation instructions gives me this error:

➜  ~ sh <(curl -L https://nixos.org/nix/install) --daemon
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  2490  100  2490    0     0   6029      0 --:--:-- --:--:-- --:--:--  6029
fish: Invalid redirection target:
sh <(curl -L https://nixos.org/nix/install) --daemon
   ^
1 Like

Well, you need to translate this call that is used for POSIX compliant shells to something that fish understands.

That call would also be equivalent to curl -L https://nixos.org/nix/install | sh --daemon if I recall correctly.

Or download and save https://nixos.org/nix/install somewhere on your disk and then run it using sh. cmod +xing it and then run it should even be enough.

Or, if even that is too much work, start a bash or zsh and then run that single command in the child shell.

The command above is to be executed in a bash shell, not a fish one. And Fish is a beautiful idiosyncratic shell; it is neither a POSIX sh or a Bash clone, and will never be. Fish prefers explicit commands and regularity over crazy syntatical constructions.

The <(command) is a “bashism” for process substitution. If you want to use the exact same “one-line download and install” semantics here, you can use the Fish command psub.

I think you can try this:

sh ( curl -L https://nixos.org/nix/install | psub) --daemon

2 Likes

Thanks for the help guys, actually this fish plugin solved the problem.