Stop Writing Instructions and Use Nix

Miao
2 min readDec 11, 2022

--

If you are still writing development environment setup instruction for your project, time to use Nix!

With Nix:

  • Any developers and CI systems can have reproducible builds and deployments regardless of the platforms (any Linux, MacOS or even Windows using WSL2) they use, thanks to Nix: the package manager.
  • You can access a large collection of packages (over 80,000 as of today) maintained by thousands of contributors, thanks to Nixpkgs.
  • There is even a dedicated Linux distribution using Nixpkgs: NixOS.

More over, you should use Nix Flakes. This upcoming new feature of Nix will power-up your build environment with a lock file that is similar to your yarn.lock/package-json.lock/Cargo.lock/etc., but for all types of projects.

It is a experience changer for many engineering organizations, e.g. at shopify.

Personally, each time I want to contribute to an open source project, the first thing I would do is to add a flake.nix to their project and decorate their CONTRIBUTING.md with a much more concise development environment setup using Nix section.

For more reasons why you should use Nix, I recommend these readings:

After you are “nix pilled” inevitably, Nix official website has a pretty decent collection of learning materials from getting started to comprehensive references.

There are also some good materials done by the community:

Further more, Nix Flakes have also its own interesting materials to read:

Happy Nix!

Originally published at http://miaozc.me.

--

--

Miao

https://miaozc.me/ mottoes: "Tu ne cede malis, sed contra audentior ito." "I have fought a good fight, I have finished my course, I have kept the faith."