It is straightforward, but so is the NixOS module system, and I could describe writing a custom module the same way you described custom Docker images.
I haven't double checked, but my recollection of that story was that they were using Git as part of the operations at runtime, not (just) as a development dependency.
It is straightforward, but so is the NixOS module system, and I could describe writing a custom module the same way you described custom Docker images.