I use Nix in a very simple way - reproducible dev environments. This is very similar to what you might do with Docker - have the right version of the right dev tools. The result is much more user friendly though because it's layered "over the top" of my normal environment rather than being it's own world (but if I want to run things in their own world I can just run nix shell with --pure).
I can then use that same environment to do CI without even creating a docker image, e.g. this for Gitlab CI:
image: nixos/nix:latest
before_script:
- nix-env -f shell.nix -i -A buildInputs
If the amount of stuff is big, or you need to build things rather than get them out of Nix cache, then you can build the docker image using Nix tooling instead.
You can also use Nix to control what is on a machine. E.g. for our lab setup we had a gateway machine behind which was all the test equipment. NixOS was great for having the exact config of that machine checked into version control so we could recreate it. It's far more reliable than Ansible or something like that.
I can then use that same environment to do CI without even creating a docker image, e.g. this for Gitlab CI:
If the amount of stuff is big, or you need to build things rather than get them out of Nix cache, then you can build the docker image using Nix tooling instead.You can also use Nix to control what is on a machine. E.g. for our lab setup we had a gateway machine behind which was all the test equipment. NixOS was great for having the exact config of that machine checked into version control so we could recreate it. It's far more reliable than Ansible or something like that.