ghcup should append, not prepend, entries to PATH
At Mercury, we use nix. Some folks have reported bizarre build errors, and it was eventually diagnosed as a conflict between nix and ghcup.
I determined that it was because ghcup's binaries were on the PATH before nix's, so I tried the obvious fix: move ghcups PATH modification after nix's. With virtually every other utility I have ever seen, this means that nix will append to PATH, and then ghcup will append to PATH, so nix binaries take higher precedence over ghcup.
This didn't fix the problem.
In my zsh install, it added a line to my .zshrc:
[ -f "/home/matt/.ghcup/env" ] && source "/home/matt/.ghcup/env" # ghcup-env
And ~/.ghcup/env contains:
export PATH="$HOME/.cabal/bin:/home/matt/.ghcup/bin:$PATH"
By prepending to the PATH, ghcup is essentially claiming "My binaries are more important than anything else you could possibly do." It violates a common expectation in how PATH is typically modified.
ghcup should be a good citizen of the ecosystem and append to PATH.
-export PATH="$HOME/.cabal/bin:/home/matt/.ghcup/bin:$PATH"
+export PATH="$PATH:$HOME/.cabal/bin:/home/matt/.ghcup/bin"