rsync service: allow running as not root

+23 -2
+23 -2
nixos/modules/services/network-filesystems/rsyncd.nix
··· 83 83 }; 84 84 }; 85 85 86 + user = mkOption { 87 + type = types.str; 88 + default = "root"; 89 + description = '' 90 + The user to run the daemon as. 91 + By default the daemon runs as root. 92 + ''; 93 + }; 94 + 95 + group = mkOption { 96 + type = types.str; 97 + default = "root"; 98 + description = '' 99 + The group to run the daemon as. 100 + By default the daemon runs as root. 101 + ''; 102 + }; 103 + 86 104 }; 87 105 }; 88 106 ··· 96 114 description = "Rsync daemon"; 97 115 wantedBy = [ "multi-user.target" ]; 98 116 restartTriggers = [ config.environment.etc."rsyncd.conf".source ]; 99 - serviceConfig.ExecStart = "${pkgs.rsync}/bin/rsync --daemon --no-detach"; 117 + serviceConfig = { 118 + ExecStart = "${pkgs.rsync}/bin/rsync --daemon --no-detach"; 119 + User = cfg.user; 120 + Group = cfg.group; 121 + }; 100 122 }; 101 - 102 123 }; 103 124 }