Merge pull request #287304 from ambroisie/pyload-user-group

nixos/pyload: add user/group options

authored by Peder Bergebakken Sundt and committed by GitHub 6f55f021 d2d988be

+23 -4
+23 -4
nixos/modules/services/networking/pyload.nix
··· 34 34 description = "Directory to store downloads."; 35 35 }; 36 36 37 + user = mkOption { 38 + type = types.str; 39 + default = "pyload"; 40 + description = "User under which pyLoad runs, and which owns the download directory."; 41 + }; 42 + 43 + group = mkOption { 44 + type = types.str; 45 + default = "pyload"; 46 + description = "Group under which pyLoad runs, and which owns the download directory."; 47 + }; 48 + 37 49 credentialsFile = mkOption { 38 50 type = with types; nullOr path; 39 51 default = null; ··· 52 64 53 65 config = lib.mkIf cfg.enable { 54 66 systemd.tmpfiles.settings.pyload = { 55 - ${cfg.downloadDirectory}.d = { }; 67 + ${cfg.downloadDirectory}.d = { inherit (cfg) user group; }; 56 68 }; 57 69 58 70 systemd.services.pyload = { ··· 80 92 cfg.downloadDirectory 81 93 ]; 82 94 83 - User = "pyload"; 84 - Group = "pyload"; 85 - DynamicUser = true; 95 + User = cfg.user; 96 + Group = cfg.group; 86 97 87 98 EnvironmentFile = lib.optional (cfg.credentialsFile != null) cfg.credentialsFile; 88 99 ··· 143 154 ]; 144 155 }; 145 156 }; 157 + 158 + users.users.pyload = lib.mkIf (cfg.user == "pyload") { 159 + isSystemUser = true; 160 + group = cfg.group; 161 + home = stateDir; 162 + }; 163 + 164 + users.groups.pyload = lib.mkIf (cfg.group == "pyload") { }; 146 165 }; 147 166 }