Using nix with csh or tcsh

The nix install process ends by saying:

To ensure that the necessary environment
variables are set, please add the line

. /Users/<user>/.nix-profile/etc/profile.d/nix.sh

to your shell profile (e.g. ~/.profile).

However, this doesn’t work for csh or tcsh users, since nix.sh uses bash-isms. Is there a work-around? Or any documentation about the environment variables that need to be set?

I really only need enough to make a #!/usr/bin/env nix-shell script work, if that matters.

Thanks!

I’m in the same place. The lack of csh support is really the only thing preventing me from adopting nix in serious way.

BTW, I just manually adapted the resulting sh to csh. I can run nix-env, but not the shell.

Fish has a similar problem. My solution there is to run bash -c '. $0; for name in "${!NIX_@}"; do printf "%s=%s\n" "$name" "${!name}"; done' ~/.nix-profile/etc/profile.d/nix.sh, then parse the lines back into environment variables. That doesn’t include PATH but I can also manually update PATH myself.

There’s also issues where any fish vendor functions/config/completions won’t be picked up by my local shell, so I also muck about with my shell’s configuration to insert Nix’s paths into the right spots, but that part is entirely optional.