Skip to main content

Implementing the dendritic pattern

I recently started migrating my NixOS configuration repository to follow the dendritic pattern.

This is a pattern where each Nix file is its own separate standalone module.

This makes it easier to refactor and re-organise files, and allows modules to be broken into multiple files.

Rather than rewrite everything at once, I decided to take an iterative approach.

This meant refactoring modules in-place within my existing configuration, and keeping everything in a working state.

I've migrated a number of modules, and will continue working through the remaining ones as time allows.

Once I've refactored everything, I'll go through them again and see what else I can do, like splitting modules into separate smaller files.

In general, the modules I've migrated have been smaller than what I had before, partly because there's less boilerplate code needed.

And, whilst there are more files, they are smaller than before, have a single responsibility and have less indentation than before - making them easier to read and understand.

Was this interesting?

Subscribe to my daily newsletter for software professionals on software development and delivery, Drupal, DevOps, community, and open-source.

About me

Picture of Oliver

I'm a certified Drupal Triple Expert and former Drupal Association staff member with 18 years of experience, a Drupal core contributor, public speaker, live streamer, and host of the Beyond Blocks podcast.