Some folks on the internet were interested in how I had managed to ditch Docker for local development. This is a slightly overdue write up on how I typically do things now with Nix, Overmind and Just.
fleek anybody?, https://getfleek.dev/
and if you want setup per project, try: https://devenv.sh/, both are nix based
I’m surprised no one has mentioned either of the following solutions as alternatives to this explanation (and docker) that still uses Nix:
Kind of cool if your production infrastructure can match. But for most companies (ie, Fortune 500 and some medium companies) implementing this would need a force majeure.
Decades of software rot, change in management, change in architecture, waxing and waning of software and hardware trends, half assed implementations, and good ole bottom tier software consultation/contractors brought into the mix make such things impossible to implement at scale.
Once worked at a company where their onprem infra was a mix of mainframe, ibm / dell proprietary crap, Oracle vendor locked, and some rhel/centos servers. Of course some servers were on different versions of the OS. So it was impossible to setup a development environment to replicate issues.
For the most part, that’s why I still use docker for most jobs. Much easier to pull in the right image, configure app deployment declaratively, and reproduce the bug(s). I would say 90% of the time it was reproducible. Before docker/containerization it was much less than that and we had to reproduce in some non production environment that was shared amongst team.
Related, this article talks about combining nix and direnv: https://determinate.systems/posts/nix-direnv
Using these tools you are able to load a reproducible environment (defined in a nix flake) by simply cding into a directory.
I use a similar approach, but I went further by creating a system that compose like docker-compose would. The trick was to write my own nix function mergeShells
.
https://her.esy.fun/posts/0024-replace-docker-compose-with-nix-shell/index.html
For now, I am pretty happy with it. Also, I put the init script inside nix-shell and not in external files and use exit signal to cleanup the state.