So today I learned something about mount: There’s a not well known feature of it, which allows specifying in fstab a bind mount with the users option, and this allows non root users to mount a directory on demand, without root permissions. Here’s where I learned it:
It appears (according to this discussion that mount needs to have these permissions in order to allow this feature:
-rwsr-xr-x 1 root root 66944 Aug 12 23:14 mount
The mount in the /nix/store doesn’t have these permissions (naturally). Therefor it is incapable of performing this operation. It can be verified if one runs:
Files in /nix/store should never have setuid permissions. That’s always done through wrapper scripts that should be created automatically in NixOS that reside in /run/wrappers/bin.
$ which ping
/run/wrappers/bin/ping
$ which unix_chkpwd
/run/wrappers/bin/unix_chkpwd
Hmm I see. So what do you think would be the best way to make this happen - via a new, enabled by default module? Or perhaps directly in utillinux itself? As in:
The derivation utillinux is unable to do it. It’s part of the system configuration.
The line you’re linking to only creates a link in sbin, which has no influence on the wrapper.
The actual wrapping happens through this:
An easier example would be the mtr module, which only creates a wrapper.