EDIT: And being new, there facilities aren't as mature, userbase smaller, so not enough work is put into packaging the latest versions. Since they also take on the goal of sandboxing the barrier for entry might be higher.
But I think the main barrier to running Docker from Nix on non-NixOS is the lack of a systemd unit file or other init system configuration in Nixpkgs. Nixpkgs just doesn't have any facilities for that atm and afaict no one is working on them right now. There are definitely precursors to that functionality in:
• the NixOS module system, which provides exactly this functionality for NixOS, where the module system is in charge of configuring systemd
• home-manager, a module system like NixOS which adds support for systemd user services on non-NixOS: https://github.com/nix-community/home-manager
• nix-processmgmt, an experimental Nix framework for writing Nix expressions to describe services to be managed by a range of process managers that may or may not be PID 1 (which means the could be usable on non-NixOS): https://github.com/svanderburg/nix-processmgmt
• nix-darwin, a module system for macOS that provides some NixOS functionality, including managing services: https://github.com/LnL7/nix-darwin
The discussion on the service abstraction layer for Nixpkgs/NixOS is also very relevant. It shows that there has been interest in something like this for many years, but it's never quite come together: https://github.com/NixOS/nixpkgs/issues/26067
I wouldn't assume it's just around the corner or inevitable. It is a really exciting possibility, though, and the nix-processmgmt framework seems like something that could evolve into a service abstraction layer for Nixpkgs that could make facilities for managing services available in a uniform way even on non-NixOS Linux.
vs. the Ubuntu one:
Package: docker.io Version: 20.10.2-0ubuntu2That's the same as the version in the latest nixpkgs unstable:
* legacyPackages.x86_64-linux.docker (20.10.2) An open source project to pack, ship and run any application as a lightweight containerAlso, afaict Nixpkgs doesn't expose any unit files for the Docker daemon, so it'd take a bit of monkeying around with a new package definition to expose the one from the Moby source so that you could use it on some random distro (or you could write your own). Nix doesn't currently have any system-wide module system for managing services on non-NixOS Linux, unfortunately.