Skip to content

nixsa can't be launched from nixsa #27

@alurm

Description

@alurm

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

  1. let nix_sh = basepath.join("state/profile/etc/profile.d/nix.sh");
  2. Nixsa is installed into the nix profile.
  3. At the end of nix.sh, we have export 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions