Do not require global nix installation
Based on the discussion in https://github.com/tweag/rules_nixpkgs/issues/54, we should enable rules_nixpkgs to use a local installation of nix that is bound to the bazel workspace somehow.
Other relevant issues: https://github.com/NixOS/nix/issues/1973, https://github.com/bazelbuild/bazel/issues/6994
What makes this hard?
For my use case, all I want to use nix for is to pull in the pg_dump binary from postgresql. This binary is needed by a Go library that dumps the schema of a database.
Hello! Someone shared a contribution to clodl (https://github.com/tweag/clodl/pull/48) to make it work with a non-global nix installation.
I don't have much of an opinion on how it should be implemented, but as a user of rules_nixpgs I would prefer for it to be handled upstream (I'm the typical user, aren't I? :stuck_out_tongue:).
If you have a clue, your input would be welcome. Is this something possible and desirable to do in rules_nixpkgs?
I've added a comment to the clodl PR https://github.com/tweag/clodl/pull/48#issuecomment-2059088567
Hello! Someone shared a contribution to clodl (tweag/clodl#48) to make it work with a non-global nix installation.
Hi. I'm that someone. :)
This now seems to work on Linux and does not seem too onerous, see https://github.com/tweag/clodl/pull/48#issuecomment-2060368436 for details.
While the contribution is for clodl this should work on any other project that uses rules_nixpkgs.
Sorry folks, mac is not supported, because nix-portable, which is the main workhorse, doesn't seem to support mac.
And that showstopper may be hiding more issues.
Do give it a test drive on Linux if so inclined. It's not overly user-friendly at the moment, so I ask for your patience if you do decide to try it. There are some rough edges that I am aware of, but do send your findings.