This project has deep debts to Christine Dodrill's blog, Domen Kožar's discussion of Nix anti-patterns, and Burke Libbey's YouTube channel.
This is a somewhat silly project intended to show you how you might use Nix in a larger, multi-language project. It's mostly a learning exercise for your truly. Each of the language directories here contains a simple, "hello world"-style project for that language that provides a Nix shell configuration (shell.nix
). The current languages:
A few characteristics of the project worth mentioning:
- This repo uses Niv to provide "pinned" versions of nixpkgs and some other repositories. I think that this approach is more declarative and "pure" than relying on the oft-encountered
<nixpkgs>
. - The
nix
directory provides not just the generatedsources.nix
andsources.json
files that Niv relies upon, but also a central source of language-specific Nix functions and variables that can be used by the language-specific sub-projects. This reduces the amount of boilerplate that's necessary in project-specific Nix files.
The goal of this repo is mostly to provide an example of how one might structure a larger Nix project. I'm starting small with just shell configs, but eventually I'd like to:
- Expand the number of languages beyond the initial three (which were chosen simply because they're the languages I know best)
- Add Nix facilities for building the projects
- Add configs for building Docker images out of the projects