Not something anyone dreamed of I guess.
With a Flake, you just need to declare a new output like this: https://github.com/aksiksi/ncdmv/blob/ebd57d02a0fe653e277003...
Then to build it:
nix build .#docker && docker load < ./result
https://nix.dev/tutorials/nixos/building-and-running-docker-...
Not something anyone dreamed of I guess.