All Projects → lucperkins → nix-monorepo

lucperkins / nix-monorepo

Licence: other
An illustration of how you might use Nix in a large, multi-language project and in accordance with best practices

Programming Languages

elixir
2628 projects
CSS
56736 projects
Nix
1067 projects
javascript
184084 projects - #8 most used programming language
HTML
75241 projects
SCSS
7915 projects

Nix Monorepo

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:

Project specifics

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 generated sources.nix and sources.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.

Project goal

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
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].