One of the main reasons I use Docker is being able to run the exact same Dockerfiles locally and in prod, with virtualisation taken care of automatically on e.g. Mac.
Is Nix a viable alternative to that?
Is Nix a viable alternative to that?
Yes, it even provides stronger reproducibility guarantees that what you build locally and what's on prod are exactly the same.
You can also build a docker container from the Nix expression, see:
https://nix.dev/tutorials/building-and-running-docker-images
If you are interested, I recommend then also checking out https://zero-to-nix.com/
Nix on the other hand will produce the same result every time wherever I run it. This alone for me is enough reason to prefer it over Docker the majority of the time.