Sharing nix-portable store between multiple users

Is it possible to share nix-portable’s store between multiple users on the same HPC system?

The documentation mentions

NP_LOCATION   where to put the `.nix-portable` dir. (defaults to `$HOME`)

among the ‘environment variables [which] are optional and can be used to override the default behaviour of nix-portable’.

Could setting this to point to some shared space, and giving group write-access to it, be a solution?

Not sure how locking to some common data structures is implemented in nix(-portable). This may lead to race conditions when e.g. accessing the sqlite database. If most of the actions are read-only, it might suffice to add a (temporary) overlayfs in between to catch the occasional writes.
There is also work-in-progress to support multiple store locations in Nix, which should help you share a common base store in a clean way.

sqlite has process locks, so race conditions won’t be an issue. but you would need to make it writable by multiple persons somehow. I don’t know if posix acl could solve that.

Would you have a pointer so some high-level-ish information about this?

@jacg

https://github.com/NixOS/rfcs/pull/152

1 Like