Skip to main content

Could Nix and devenv replace Docker Compose?

I started using the Nix package manager in September 2022 as a replacement for Ansible to manage my dotfiles.

Since then, I've switched to daily-driving NixOS as my main operating system and started to use Nix instead of Docker for some development projects.

Even though I'm running Linux, there's a benefit to not running containers for simple projects as well as the reproducibility that Nix provides.

I hadn't invested much time in using Nix as Docker replacement for Drupal projects, but this week, I've started to look at devenv - a development tool based on Nix.

As well as declaring and locking the package versions I need for each project, it also manages the services I need, such as PHP-FPM and MariaDB or MySQL.

It also configures Git hooks, test scripts and custom processes, such as running Tailwind CSS.

I've configured it for a few projects this week and it could be a potential Docker replacement for me.

If you want to see an example, see this repo on GitHub.

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.