timbertson/runix

Support installing libraries

benmkw opened this issue · 4 comments

Thanks for creating this project which looks great!

I’m not (yet) using nix but this would be a perfect entry point for me/ using the binary nix store as a replacement for homebrew.

I would like to use this somewhat in the style of homebrew + venv such that each project can have its libraries installed in a local cache folder.

Does this already support installing libraries/ setting the search paths for them?

No, it only sets $PATH today. Adding support for arbitrary mutations to envvars is probably possible, but you'd never be able to replicate the various setuphooks properly, so it'd likely be quite fragile. At this point I think if you're building against nix-distributed libraries, it seems wiser to just use nix.

If you want to try it out though, I think you could make a derivation which sets whatever envvars you like and then runs bash or whatever, to drop into a nix-shell of your own making.

No, it only sets $PATH today. Adding support for arbitrary mutations to envvars is probably possible, but you'd never be able to replicate the various setuphooks properly, so it'd likely be quite fragile

On second thought it might not really be needed for runix to do these things because with homebrew one also needs to set LD_LIBRARY_PATH or CFLAGS -I to point to specific paths.

It would be good though to have a way for runix to query the nix package cache, like the example

nix-instantiate --eval -A jq.outPath ''
"/nix/store/wdyfn985sx8001qnsb525fbgm151wm2r-jq-1.6-bin"

but without requiring a nix install, with just runix.

This would also help with finding libraries like e.g. boost and then presumably they would be symlinked into something like ~/.cache/runix/boost and one could set ~/.cache/runix/boost/include or sth. similar in the environment to use it in a project.

A benefit over homebrew could be that each project can have the dependencies in a file and when activating that environment, runix could symlink the correct files into ~/.cache/runix/` or maybe even into a project lokal cache which would enable having multiple versions of the same library installed, much like with venvs in python.

nix-instantiate --eval -A jq.outPath

That can't really be done without a nix installation, runix needs to be told exact derivation names in order to fetch anything useful (there's no way to search a cache).

These are interesting ideas but I'm going to close since it's a fair way outside runix's scope today.