Distrobox seems wonky on NixOS

I’ve already posted this on distrobox ([Question] Distrobox mounts /nix into containers · Issue #837 · 89luca89/distrobox · GitHub), but the community here seems really engaged, so I thought I’d give it a shot…

I’m using NixOS 23.05 with Cinnamon de, though I tested with NixOS unstable and found similar results. This is with distrobox+podman.

I’m getting strange behavior when I try to use distrobox on NixOS. The root cause seems to be that the /nix directory gets mounted inside the distrobox container. This means (as far as I know) that you cannot set up a separate nix install inside the container, for example if you want to use home-manager for things in the container.

Beyond that, any time I run a distrobox command, e.g., “distrobox list”, inside a container (which I do fairly often, simply by accident), everything gets into a weird state where I get an error message (""ERRO[0000] User-selected graph driver “overlay” overwritten by graph driver “vfs” from database - delete libpod local files to resolve ") any time I run any podman command, even outside the container. At this point, the only option appears to be to delete ~/.local/share/containers and reinstall podman.

So my question would be, has anyone else had success using distrobox on NixOS? Should I maybe find a way to unmount /nix inside the container?

Thanks for the help.

I am using Distrobox every now and then for Yocto development. As distrobox tries to map many things from the outside into your container, naturally you have your nix command from outside and the store available.

Distrobox is only a small wrapper around docker/podman and the code is fairly readable. If you have special needs, you can always take a hint from the sourcecode and create the containers using the podman CLI.