Luminescent Dreams

Mononix

July 09, 2023

As though I don’t have enough projects, I actually have another one.

For the longest time, I’ve had a huge amount of frustration with Nix as a developer, because normal build tools are hostile to Nix, and the Nix build tools are fractious and don’t really function well together, or work with the build tools for other languages. Just in Rust, I have tried buildRustPackage, buildRustCrate, Crane, crate2nix, and cargo2nix. And then in Javascript I’ve worked with node2nix and npm2nix, and buildNodePackage. There are no tools in C, though arguably C applications are the easiest of all things to build in Rust. Given that C doesn’t have a package manager, so there is no need to fight against the toolchains in order to build a C app in Nix with well-defined toolchains and dependencies.

Basically, C apps are the easiest ones to build and package with Nix. In many ways, that also makes them the easiest ones to distribute.

Most other applications, though, are a total pain. The best way I’ve generally found to distribute a Rust application is to build it entirely outside of Nix, upload the binary to somewhere, and then have the Nix derivation download, patch, and install it.

Technically, that’s the right way for end users.

As a developer, though, I really need to be able to use Nix as a toolchain. I want to be able to build up some reasonable layers atop of all of the things that I build so that I can piece them together with quite a lot less pain.

So, I’m going to try this. I have barely any of the necessary skills, except insofar as I have built applications many times, I have used Nix, and I have even written a couple of Nix derivations.

I’m calling the project Mononix, because I will be using Nix to build a monorepo.

I’ve set up demo-repo as the test setup. I’ll be using this to figure out how to build a bunch of projects without all of the complications of my existing projects.

If this is something that interests you, please consider whether you would like to join the project, as a tester, as an advisor, or even as a contributor. I could also use a cheerleader.