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 description = "Directory to store downloads."; 35 }; 36 37 credentialsFile = mkOption { 38 type = with types; nullOr path; 39 default = null; ··· 52 53 config = lib.mkIf cfg.enable { 54 systemd.tmpfiles.settings.pyload = { 55 - ${cfg.downloadDirectory}.d = { }; 56 }; 57 58 systemd.services.pyload = { ··· 80 cfg.downloadDirectory 81 ]; 82 83 - User = "pyload"; 84 - Group = "pyload"; 85 - DynamicUser = true; 86 87 EnvironmentFile = lib.optional (cfg.credentialsFile != null) cfg.credentialsFile; 88 ··· 143 ]; 144 }; 145 }; 146 }; 147 }
··· 34 description = "Directory to store downloads."; 35 }; 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 + 49 credentialsFile = mkOption { 50 type = with types; nullOr path; 51 default = null; ··· 64 65 config = lib.mkIf cfg.enable { 66 systemd.tmpfiles.settings.pyload = { 67 + ${cfg.downloadDirectory}.d = { inherit (cfg) user group; }; 68 }; 69 70 systemd.services.pyload = { ··· 92 cfg.downloadDirectory 93 ]; 94 95 + User = cfg.user; 96 + Group = cfg.group; 97 98 EnvironmentFile = lib.optional (cfg.credentialsFile != null) cfg.credentialsFile; 99 ··· 154 ]; 155 }; 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") { }; 165 }; 166 }