nix-community / comma

Comma runs software without installing it. [maintainers=@Artturin,@burke,@DavHau]
1.09k stars 48 forks source link

Add an option to print the path instead of running it #75

Closed diniamo closed 5 months ago

diniamo commented 6 months ago

Hacky, but I couldn't come up with a better way, even though there probably is. Still, I think this would be a useful feature.

Artturin commented 5 months ago

What is this useful for?

If it's useful only rarely then the following can be used instead. nix-locate -w --at-root -- "/bin/hello" | fzf | awk '{print $4}' /nix/store/l1mr8ky0gzpbp4jc7vfj6g3xp6y1z015-hello-1.0.0.2/bin/hello

diniamo commented 5 months ago

Well, can it hurt to have this feature? By the time I finished the code for this, I actually forgot what I needed it for, but the main use case would be using the path in programs and scripts where providing the executable with PATH is a hassle or impossible.

I doubt nix-locate downloads the package if it's not in the store.