rules_nixpkgs icon indicating copy to clipboard operation
rules_nixpkgs copied to clipboard

Devbox support

Open aaomidi opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? Please describe. Inability to use my existing devbox.lock file with this rule is a bit frustrating, but its not necessarily this tools job :P.

Describe the solution you'd like I already use devbox for dependency management for the tools I use. I would like if I can reuse the same devbox.lock file that I use for my local dev environment, inside Bazel.

Describe alternatives you've considered Just using rules_nixpkgs

Additional context https://github.com/jetify-com/devbox/issues/2268

aaomidi avatar Sep 12 '24 16:09 aaomidi

I think that should actually not be too complicated. You could create a repository rule which reads the lock file (it's just JSON) and extracts the resolved value (which looks like github:NixOS/nixpkgs/5775c2583f1801df7b790bf7f7d710a19bac66f4#ripgrep) of each tool you want to import.

Then, split at the # and generate a call to nixpkgs_git_repository for the first part, a nixpkgs_package (or toolchain rule) for the second.

avdv avatar Sep 13 '24 12:09 avdv

Given that it needs to invoke other repository rules it might even lend itself better to a module extension. You can take a look at nix_pkg and nix_repo for reference.

aherrmann avatar Sep 16 '24 13:09 aherrmann