Cameron Yule

Contributing to Nix

I recently made my first contribution to Nixpkgs, the package collection for NixOS, and wanted to document a few notes and learnings from that process. Nix is an ecosystem of tools which together enable reproducible, declarative and reliable systems. It’s comprised of a package manager (Nix), a packages collection (Nixpkgs), a functional language (Nix expressions), and a Linux distribution built using those tools (NixOS).

Nix first caught my attention while I was researching the concept of reproducible builds, which enables verification that binaries were created from a specific version of their source. While reproducible builds offer many benefits, they’re also becoming increasingly important in securing the software supply chain. Nix on its own does not guarantee bit-for-bit reproducibility, but offers the tools to achieve it and reports on the reproducibility of NixOS, which is typically above 99%.

My first contribution was a version update for the mlx Python package. mlx is an open-source array framework from Apple which, when used with Apple’s mlx-lm, allows large language models to run efficiently by leveraging the unified memory architecture of Apple Silicon. I’d tried to install mlx from Nixpkgs, but encountered a build failure for which there was an open bug report.

At a high-level, the process was:

Nix has a reputation – sometimes deserved – for it’s difficulty curve, but I found the process of contributing to be both welcoming and well documented.

Tags: til, nix, open-source