Guide to multi-app development?

I’m new to Nix and looking for a guide for setting up Nix for multi-app development. What do I mean by multi-app development? I work on a microservice architecture, so our full stack comprises of 30+ applications, each with their own dependencies, configuration via environment variables, etc. Most of the guides I’ve found get me pretty far for setting up one of those in Nix with an appropriate development environment, etc., but I have yet to find a guide about how to connect these disparate Nix setups into a cohesive and easy-to-manage unit.

Previously I was using docker-compose. Now I have some shell scripts that will conditionally enable/disable supervisord configurations to turn on some applications and others off, and to have them all pull from a shared configuration source if they share resources (like databases or object stores). There are some apps that must always run, like a local reverse proxy and dns server.

I feel like I should be able to do this in Nix, where each application is described by a flake or something and then I have a larger flake that consumes those as inputs, somehow allowing me control as to which flakes to consume and which to ignore—depending on what service I’m doing development on, I don’t need the others to run and consume resources—but I haven’t been able to figure this out on my own.

What I would love is a guide that starts with configuring three applications independently (file watching & server reloading, building assets, development environment, environment variables sourced from a central source, etc.), then goes on to show how to link them together, so that you can develop on a stack of apps instead of just one in isolation. While my apps run NodeJS, I don’t really care if the guide targets that stack; if I can see how the pieces fit in Nix, I feel confident I can transpose that knowledge.

Does that make sense? Is there already a guide out there that shows this that I’ve been unable to find? If not, anyone feel up for making one? Appreciate the help. Thanks!

1 Like