Automate Project Environments with Devbox and Direnv


46 points | by jljljl 15 days ago


  • cquintana92 14 days ago
    Been using Devbox recently both at work and for personal projects and I can only say good things. It abstracts away the complexity of nix, defining the dependencies in a simple json with a lock file, the shell starts quite fast and from then on you have everything under your PATH, and it works the same in macOS and Linux.

    Also, as a benefit, by tracking the JSON and lockfile, the CI can work with the exact same environment. I highly recommend giving it a try.

  • aerzen 14 days ago
    This is the way. We should make it a standard practice for oss projects that one is able to git clone, direnv allow and build the project.

    Regardless of the distro or even OS. An easy thing to say, but hard to execute on actual projects with patched versions of cPython and some obscure in-house build tool.

  • Mathnerd314 14 days ago
    > despite it being a very useful tool, its setup requires investing time and getting over the Nix ecosystem's learning curve.

    They mention Nix but I guess they are referring to the use_nix integration built-in to direnv? There is a fairly detailed (but old) comparison in and in the meantime lorri and nix-direnv are the only ones still maintained. But you aren't limited to Nix when using direnv, for example there is nvm.

    Actually, the post's solution, besides being built on top of direnv, uses Devbox, which itself is built on top of Nix... So they are saying they are outside the Nix ecosystem when in fact they are in it. It is yet another set of nice scripts on top of Nix.

    • dudus 14 days ago
      This seems to be mostly a thin wrapper with a nice interface around nix-shell. Replaces Nix (the language) with this random json format inspired by node package.js. Keeps Nix packages.
    • a1445c8b 14 days ago
      Maybe they meant to reference nix-direnv?
  • azaras 14 days ago
    Why do not use asdf?
    • FireInsight 14 days ago
      Use mise instead; it's fast, it gets out of your way, it's easy to use, and it's compatible with asdf plugins.

      Can't manage lower-level deps like dynamic libraries and C compilers, though. I just containerize those.

    • pprotas 14 days ago
      Asdf slows down the shell