NixOS container limitations


I saw the note in NixOS manual (

Warning: Currently, NixOS containers are not perfectly isolated from the host system. This means that a user with root access to the container can do things that affect the host. So you should not give container root access to untrusted users.

Is there any detail why there’s that limitation and if currently someone is working on that.


The reason for this is that it uses systemd-nspawn and at the time the implementation was written there was no support for user namespaces. Nowadays however we could add support for that…


Nowadays however we could add support for that…

I guess that would be a great feature and would eliminate some use cases where docker or lxc or lxd is used today.


Just found a PR that does exactly that:

Until it is merged (once the issues are resolved), you could add -U to extraFlags on a per-case basis.


Thanks for clearification!