Closed kuruczgy closed 1 month ago
Apparently this got recently documented in NixOS: https://github.com/NixOS/nixpkgs/pull/273384 We could just link to this in the README and the option docstring.
Thank you for this issue. I had troubles with folders getting the wrong owner after a reboot and couldn't figure out why
The examples do show
/var/lib/nixos
being persisted, but it's never mentioned that doing so is vital to the correct functioning of the UID/GID allocation mechanism of NixOS.If
/var/lib/nixos
is not persisted, UIDs/GIDs are allocated sequentially, and so can shift around across boots if new ones are added to the configuration. It can happen that after a reboot, a file is now randomly owned by a different user.The documentation should warn about this, and as a longer term solution I would suggest adding an assertion: Only allow
/var/lib/nixos
to not be persisted if all users/groups have explicitly declared ids.