NixOS/nixos — pull request #168 by rickynils (2013-05-22 14:57:22+00:00)
Title: Generate /etc/passwd and /etc/group statically

This is a rather large pull request that switches user/group creation from using `useradd` to just generating the contents of `/etc/passwd` and `/etc/group`. This makes the user activation process much cleaner, in my opinion. However, it also makes it impossible to use `useradd` manually. All users must be defined in `users.extraUsers`. Also, `users.extraUsers..uid` and `users.extraGroups..gid` must all be properly defined (if `.createUser` is true, which is by default). My pull request adds a lot of uids/gids to `config.ids` to solve this problem for existing nixos services, but there might be configurations that break because this change. However, this will be discovered during the build.

The pull request removes the options `.isSystemUser` and `.isAlias` since they don't make sense when generating `/etc/passwd`. It adds `.members` as a complement to `.extraGroups`. It also adds the option `users.lockRoot` for locking the root account from login. And it adds `.passwordFile` for setting a user's password from an encrypted (shadow-style) file.

You can still change passwords for users manually, since the user activation will not touch `/etc/shadow`.

I have tested this on a couple of different systems and it seems to work fine so far. If you think this is a good idea, please test it. This way of adding local users has been discussed in issue #103 (and this pull request solves that issue).