An overhaul of the current NixOS module which adds a users feature, makes the module more extensible, adds permissions handling, and asserts that no duplicates are specified:
Implement support for user files and directories
Allow user files and directories to be specified as follows:
This provides an alternative to the home-manager module and may even deprecate it in the future.
Refactor the module to simplify future extensibility
Implement support for a submodule representation for files and directories. Strings are automatically converted to appropriate submodule representations and each file and directory is handled based only on their respective submodule's attributes. This means that for most files, a string will suffice, but if more advanced options need to be set for the specific files or directories, a submodule can be used instead. It also, arguably, simplifies the implementation a bit.
Add support for custom permissions on created directories
Building on the extensibility mentioned above, allow the owner and mode to be set when directories are created in persistent storage by the create-directories.bash script. Very useful for directories used to store secrets.
Also, make sure the user directories are created with reasonable defaults, i.e. owned by the user and its group, not by root:root.
An overhaul of the current NixOS module which adds a
users
feature, makes the module more extensible, adds permissions handling, and asserts that no duplicates are specified:Implement support for user files and directories
Allow user files and directories to be specified as follows:
This provides an alternative to the home-manager module and may even deprecate it in the future.
Refactor the module to simplify future extensibility
Implement support for a submodule representation for files and directories. Strings are automatically converted to appropriate submodule representations and each file and directory is handled based only on their respective submodule's attributes. This means that for most files, a string will suffice, but if more advanced options need to be set for the specific files or directories, a submodule can be used instead. It also, arguably, simplifies the implementation a bit.
Add support for custom permissions on created directories
Building on the extensibility mentioned above, allow the owner and mode to be set when directories are created in persistent storage by the
create-directories.bash
script. Very useful for directories used to store secrets.Also, make sure the user directories are created with reasonable defaults, i.e. owned by the user and its group, not by
root:root
.Here is an example of this in use:
Assert that no duplicate files or directories are specified
Make sure the same files or directories aren't specified multiple times, either between persistent storage paths or in the same path.