I’ve noticed that running commands like pbcopy from kakoune stopped working suddenly. I’m not sure if it’s when I upgraded nixpkgs a week ago or when I switched from Homebrew kakoune to Nix’s.
The reason is that the PATH does not contain my PATH, e.g. /usr/bin. If I run nix shell nixpkgs#kakoune and then type !echo $PATH, I get only entries in the Nix store:
Actually, since I’m here, here’s a vaguely related question:
What is the difference between the “wrapped” kakoune and kakoune-unwrapped? As far as I can tell, the bug never affected the latter.
I’ve seen that many of my Nix programs are installed “wrapped” by default and some also have “unwrapped” versions. I’m not sure what difference that makes in practice.
Yes, some packages don’t have a separate wrapper package either, and just use the wrapper directly in the original expression (see: most electron apps).
Ultimately you’d have to check the code to see what is part of the wrapper and whether you want that behaviour or not.
Generally, wrappers add paths to auxiliary executables, libraries, and data files, as well as setting any other required environment variables. You should expect the experience of an unwrapped binary to vary between “some functionality that uses external executables doesn’t function out of the box” and “won’t even start at all”.
The wrapper, and the unwrapped executable, are basically implementation details; if a wrapper exists, there’s not really any guarantee or support for running the unwrapped executable unless you know what you’re doing. Usually there aren’t bugs quite this bad in them, though!
In the case of Kakoune, however, the wrapper just sets up Nix‐packaged plugins you have opted into using, so unless you use those there should be no downside to using the unwrapped binary. Much of the time (e.g. for all Python, GTK, and Qt apps) the wrappers are more important than that, though. Since Nix uses a weird filesystem layout we are often having to tell applications where they can actually find things. Environment variables aren’t the ideal way to do that – they leak into subprocesses, which can cause issues with Python’s PYTHONPATH, for instance – but they’re often what we have to work with.