boot.initrd.systemd.tmpfiles will create directories owned by root as expected when boot.initrd.systemd.tmpfiles.settings.<config-name>.<path>.<tmpfiles-type>.user is not specified in the configuration. However, setting boot.initrd.systemd.tmpfiles.settings....user to my regular user so that the created directory will be owned by that user results in no directory being created.
This creates a directory owned by root:
boot.initrd.systemd.tmpfiles.settings."persist" = {
"/sysroot/user/foo".d = {
};
};
This creates nothing:
boot.initrd.systemd.tmpfiles.settings."persist" = {
"/sysroot/user/foo".d = {
user = "user";
};
};
My user configuration:
users.users.user = {
isNormalUser = true;
extraGroups = [
"wheel" # Enable ‘sudo’ for the user.
"libvirtd"
"pipewire"
];
};
The tmpfiles.d manpage says this about the user and group fields of its rules:
This field should generally only reference system users/groups, i.e. users/groups that are guaranteed to be resolvable during early boot. If this field references users/groups that only become resolvable during later boot (i.e. after NIS, LDAP or a similar networked directory service become available), execution of the operations declared by the line will likely fail.
According to https://systemd.io/UIDS-GIDS/#notes-on-resolvability-of-user-and-group-names,
Regular users do not need to be resolvable during early boot, it is sufficient if they become resolvable during late boot. Specifically, regular users need to be resolvable at the point in time the
nss-user-lookup.targetunit is reached.
Since we have the option of specifiying the user with boot.initrd.systemd.tmpfiles.settings.<config-name>.<path>.<tmpfiles-type>.user, I would think that regular users and groups would be resolvable when systemd-tmpfiles runs in the initrd.
In NixOS, are regular users/groups not expected to be resolvable when 'systemd-tmpfiles` runs in the initrd stage of the boot process? Am I doing something wrong here? Any help would be appreciated.