Ruby-Nix: Generates reproducible Ruby/bundler app environment with Nix
github.com
github.com
Every single language seems to have a half-assed tool to help do this sort of thing... asdf, virtualenv, etc. If you learn a little Nix, you can basically have a real solution that usurps all of these other ones, across all languages
(honest question)
In my Elixir app's case, the app was not deterministically reproducible using only asdf because it had underlying dependencies (a NIF, in this case VIPS) that required either C or Rust compilation at build time, and that in turn required another stack of dependencies with specific versions (which often broke the build), and even if that was all lined up, there are outside dependencies such as SSL libraries which can make or break builds when not using something like Nix (which gives you total control over every dependency). But the funny thing is that all I had to do was specify "vips" as an input, and since Nix already takes care of giving vips whatever IT needs to build correctly, it was basically a no-op to make this work with Nix.
Given the fact that you can output a Docker from a nix recipe/derivation https://thewagner.net/blog/2021/02/25/building-container-ima... , it also supersedes Docker IMHO
Here's a link to one of a few blogposts about building container images with nix: https://thewagner.net/blog/2021/02/25/building-container-ima...
Here's a few good links to get started:
https://nixcloud.io/tour/?id=1 < This one's a pretty cool interactive nix language tour that works by asking you to solve progressively more challenging problems and then validates the solution by actually running it- I love this approach to learning a language.
I’m starting to switch to local rocker-compose for dev, and also for deploying simple apps to single VPS instances.
Should I learn Nix? What’s a good starting place to do that?
In general, check out nix.dev as a starting point.
For a deep dive on how it works with a focus on modern features, check out this blog series: https://tonyfinn.com/blog/nix-from-first-principles-flake-ed...
There's a very cool interactive tutorial here which fit the way I like to learn pretty perfectly: https://nixcloud.io/tour/?id=1 It's an actual Nix interpreter running in the browser (thanks to emscripten) that validates your answers by actually evaluating them, through a series of progressively more difficult questions.
Not sure how long you've been doing ruby dev but that has historically been a path to a lot of pain, especially once native gems come into play.
But looking at it from a perspective where Nixpkgs is the upstream: what does this introduce that would be unwelcome in Nixpkgs' bundlerEnv, or perhaps situated so it can share code with the existing implementations?
Trialing new designs in your own space is a pretty common pattern and there’s ample history of good ideas being adopted upstream once proven.
Or sometimes you just might not have the energy for it. It’s okay for your gift to the world to merely be available, without pressure to go farther.