Fixed-point combinators at work in Nixpkgs (2023-04-08)

Nix is a purely functional package manager, getting popular in this decade among developers and researchers who build software in Linux and macOS. It comes with a dedicated domain-specific language, called Nix too, allowing to manage builds by declarative programming with lazy evaluation.

We highly recommend Nix not only for those who would like reproducible builds, but also for reproducible computational experiments; plenty of existing programs are available for deploying yours on top of them via Nixpkgs, the de-facto package repository of Nix. Note that, although the Nix project provides even a Linux distribution named NixOS, you do not have to run the OS to use the Nix package manager. Please find more details from the official documentation and other resources such as the NixOS Wiki,, Zero to Nix, etc.

It is noteworthy that in Nixpkgs fixed-point combinators, implemented in the Nix language, make it possible to customize a build by, e.g., injecting additional dependencies or overriding build options.

Its plain form is found in the source tree of Nixpkgs. The library function lib.fix is an obvious fixed-point combinator. The following pages describe some examples of its usage:

Even better, the practice adopted in Nixpkgs has established a so-called callPackage pattern to maximize the effectiveness.

There is also a paper in computer science that explains the foundation of Nix's design and implementation.

© 2006-2023