-
Notifications
You must be signed in to change notification settings - Fork 4
Description
I'm not sure how much of an issue this is in practice, but maybe this issue helps somebody.
Minimal example
$ nixsa nixsa
Error: Couldn't find a directory containing /proc/self/exe which contains a `nixsa.toml` file.
The error is a bit confusing.
Why this happens
Line 204 in ef616c6
let nix_sh = basepath.join("state/profile/etc/profile.d/nix.sh"); - Nixsa is installed into the nix profile.
- At the end of
nix.sh, we haveexport PATH="$NIX_LINK/bin:$PATH"
So a nixsa from /nix/store gets launched, which only has bin/nixsa and no nixsa.toml.
Workarounds
Don't launch nixsa from nixsa.
Potential solutions
I don't know. Maybe nixsa can be prepended to path after nix.sh is sourced? But maybe this introduces different issues.
Maybe the issue can be made less confusing by providing an error message that is easier to understand. It took me a while to figure out why you can't launch nixsa from nixsa (I couldn't get it why it can't find nixsa.toml).
Not installing nixsa to the default profile also seems wrong.
How I encountered this
I encountered this because I used exec nixsa fish in my ~/.config/fish/config.fish to use a fish more recent than my system's. (To be fair, maybe this isn't the best solution to my problem.)
Then, nixsa can't be used from fish. Also, tmux and other programs which launch a login shell in their default configuration can't be used.