I’m relatively new to nix and have already used it to configure my home-environment and my NixOS installation.
Now I wanted to get some hands-on experience using it during development. The main problem is that I don’t want to use nix just for the sake of using it.
The Situation is the following:
- Monorepo including frontend and backend, both Node Projects
- Backend is Nestjs
- Frontend Angular
- Mongodb as the database
- Optionally a redis instance for volatile values, depends on the project config
In frontend and backend exist docker-compose.yml files which launch all the services needed for testing the application locally.
Now I wanted to create a shell.nix file to provide all the dev-dependencies for working on the project. One of my goals is to show my colleagues how easy it is to set up dev environments using nix.
This is easily done for most of the programs needed, but when it comes to docker I hit a roadblock.
As I have read it online it seems that including docker as a dependency in a shell.nix file is finicky as you have to make sure that the virtualization-options on your machine are configured correctly.
Some people say, that the “nix way” to handle this, would be to completely replace the docker-compose part of the workflow by making sure that the services are running in the shell-hook of the shell.nix file. However I don’t want to be too pushy towards the other devs on my team.
As it stands now I’ve only added all the packages needed for development - excluding docker - and print a message that it assumes that docker is running correctly on the machine.
Another question I was asking myself was: “should I try to ‘replace’ npm with nix-build?”. But to be honest I don’t see the benefit of that at the moment when the application is currently only in development and is never meant to be shared apart from our repository. Maybe I could replace the Dockerfile using nix tooling for deploying the application to our servers?
How would you handle the situation? I’m grateful for every piece of advice!
However, I would like to stay away from flakes until I have a solid grasp on the basics.
Cheers! And thanks in advance!