devbox icon indicating copy to clipboard operation
devbox copied to clipboard

Is there some kind of escape hatch to use nix

Open takeda opened this issue 1 year ago • 1 comments

What problem are you trying to solve?

This is more of a question, but perhaps is a feature request. I want to be able to have some kind of escape hatch where I can also use other Nix features. For example being able to use Nix to build my code. Is there a way to do it with devbox?

At this moment a missing piece for me is for example ability to generate path that would contain go stdlib that I can then point my IDE to.

What solution would you like?

For example with pure nix in the flake I could add:

          packages.env = pkgs.symlinkJoin {
            name = "Go env";
            paths = [
              pkgs.go
            ];
          };

And then when I would run nix build -o go-env .#env I would get a symlink in my project directory called go-env which I could then reference in GoLand. Is it possible to do the same thing with devbox?

Alternatives you've considered

No response

takeda avatar Mar 13 '24 07:03 takeda

Hey @takeda,

One escape hatch we do support is that you can use a Nix flake to define a custom package that you want to build, and then import it into your shell via a devbox.json. We describe that feature in our documentation here: https://www.jetpack.io/devbox/docs/guides/using_flakes/, and we have a few examples in our repo: https://github.com/jetpack-io/devbox/tree/main/examples/flakes.

I think better integrations with Nix are a good idea though, what would you want to see beyond the flake support described above?

For your specific use case -- we also generate symlinks to the contents of all the packages you install in the .devbox directory, and set this path in the env variable $DEVBOX_PACKAGES_DIR when you start your shell. Would this help in configuring GoLand?

Lagoja avatar Mar 14 '24 05:03 Lagoja