Nix vs Docker

NixDocker
Application domainPackage managementProcess/service management
Storage unitsPackage build resultsFile system changes
Storage modelIsolated Nix store pathsLayers + union file system
Component addressingHashes computed from inputsHashes computed from a layer’s contents
Service/process managementUnsupportedFirst-class feature
Package managementFirst class supportDelegated responsibility to a distro’s package manager
Development environmentsnix-shellCreate image with dependencies + run shell session in container
Build management (images)DockerfiledockerTools.buildImage {}
dockerTools.buildLayeredImage {}
Build management (packages)First class function supportImplementer’s responsibility, can be simulated
Build environment purityMany precautions takenOnly images provide some reproducibility, implementer’s responsibility
Full source traceabilityYes (on Linux)No
OS supportMany UNIX-like systemsLinux (real system or virtualized)

https://sandervanderburg.blogspot.com/2020/07/on-using-nix-and-docker-as-deployment.html