A NixOS module to enforce permissions on a path and it's sub-directories.
For example to make sure that /srv/www/
always belongs to nginx:www
, you can use this module
in the following way.
services.permown."/srv/www" = {
owner = "nginx";
group = "www";
};
The code is extracted from stockholm the krebs repository and slightly modified.