Starting a personal monorepo

I’ve been using Nix as my package manager for 4 years now and it has been the best computer-related decision I have ever made and, fortunately, for the past few years its ecosystem has been growing a lot1 , 2 , 3. Some of this movement is due to the advent of Flakes that makes it way easier to share reproducible outputs than the previous Nix solution of channels.

Considering that I can use Nix:

I thought to myself: “Why not build a personal monorepo”? I mean, this might sound like a weird conclusion to take from all of this but I can explain! I swear!

Rationale

Sometimes I just get bored setting up a new project. Create a new repository, setup the dependencies, write a CI manifest… it’s too tiresome! I won’t even mention the pain in the ass that is to write multiple projects on the multiple machines. The clone, fetch, pull and push dance is just too much when I could be coding already.

Most of my personal projects are written in Go, a really boring language that takes its time to include new features and release new versions. This means that an update won’t break them and that I can take advantage of a way to share the same compiler and tooling version through my projects.

If you’re a Nix user, a single command would show you all the outputs available for use: nix flake show sourcehut:~glorifiedgluer/monorepo. This also means that you can import this repo as an input on your flake.nix file and use any of my projects as you please.

The CI can be simplified to a simple shell conditional:

tasks:
  - someproject: |
      cd monorepo
      if ! $(git diff --quiet HEAD HEAD^ -- "someproject")
      then
        # do something if the project got an update
      fi      

Nonetheless, the best reason to try this is out is to have some fun and explore new challenges with version control and build systems! ;-)

Expectation

I mean… none? lol. Being serious now, I don’t expect my projects to become something used by hundreds or thousands of users as most of them are done out of passion/need. So the rationale above is composed of things that personally took out part of the joy of bulding out something and seeing it run.

Is this going to work? I have no idea as I don’t have much experience with monorepos. I’m not really sure if this is going to scale or bore me in other ways. The only certainty I have is that I’m having fun doing it right now!

You can see the repository on the links below:



Articles from blogs I follow around the net

Variations of the Range kata

In the languages I usually employ. The Range kata is succinct, bordering on the spartan in both description and requirements. To be honest, it's hardly the most inspiring kata available, and yet it may help showcase a few in…

via ploeh blog January 1, 2024

Some notes on NixOS

Hello! Over the holidays I decided it might be fun to run NixOS on one of my servers, as part of my continuing experiments with Nix. My motivation for this was that previously I was using Ansible to provision the server, but then I’d ad hoc installed a bunch…

via Julia Evans January 1, 2024

I found some of my first code! Annotating and reflecting on robotics code from 2009.

In high school, one of my teachers shattered my plans for my life, in the most beautiful way. Most of my life, I'd intended to become a math professional of some sort: a math teacher, when that was all I saw math for; an actuary, when I started to lear…

via ntietz.com blog January 1, 2024

Generated by openring