… and make all its effects apply only to the root account, as if they were defined by the root account’s profile, but without actually creating a profile for the root account.
(You may assume that the systemwide configuration includes programs.nano.enable=false and environment.defaultPackages=lib.mkForce [].)
It looks like I can get most of what I want with users.users.root.packages. The biggest missing piece is a declarative way to set environment variables for specific users (something like users.users.<name>.environment.sessionVariables).
Hjem is an alt project compared to home-manager that does allow management of root, though it’s merely a simple mechanism for basic tasks like linking files. However, that is likely enough to set the appropriate rc file.
The point was only for a way to configure the root’s shell environment. I’m not sure if that is what they’re looking for but linking a file into root’s home might be good enough, which can be done with hjem and cannot be done at all with home-manager.
and fyi I’m one of the authors of hjem and it currently doesn’t satisfy this requirement, though we’re open to it. I’ve not tested root user config either.
Thinking about it some more, it occurs to me that I don’t need pam_mount compatibility on the machine where I was trying to restrict a bunch of shell commands to root, and I also don’t need most of home-manager’s fanciness. hjem might be just the thing, I’ll look at it.