about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeder Bergebakken Sundt <pbsds@hotmail.com>2024-02-10 14:59:23 +0100
committerGitHub <noreply@github.com>2024-02-10 14:59:23 +0100
commit6f55f021df5201dc00f8d9c4b6b02e0db04b1aea (patch)
tree8192452273d30db8667ea72f8ef7f8fbcce325a2
parentd2d988bef18b5c35383786c55c1a2ad7de744952 (diff)
parentc14f029dae7a6eba976549df6a787f9cbbfd444b (diff)
downloadnixlib-6f55f021df5201dc00f8d9c4b6b02e0db04b1aea.tar
nixlib-6f55f021df5201dc00f8d9c4b6b02e0db04b1aea.tar.gz
nixlib-6f55f021df5201dc00f8d9c4b6b02e0db04b1aea.tar.bz2
nixlib-6f55f021df5201dc00f8d9c4b6b02e0db04b1aea.tar.lz
nixlib-6f55f021df5201dc00f8d9c4b6b02e0db04b1aea.tar.xz
nixlib-6f55f021df5201dc00f8d9c4b6b02e0db04b1aea.tar.zst
nixlib-6f55f021df5201dc00f8d9c4b6b02e0db04b1aea.zip
Merge pull request #287304 from ambroisie/pyload-user-group
nixos/pyload: add user/group options
-rw-r--r--nixos/modules/services/networking/pyload.nix27
1 files changed, 23 insertions, 4 deletions
diff --git a/nixos/modules/services/networking/pyload.nix b/nixos/modules/services/networking/pyload.nix
index f2b85499d4dd..93f8dd7d731a 100644
--- a/nixos/modules/services/networking/pyload.nix
+++ b/nixos/modules/services/networking/pyload.nix
@@ -34,6 +34,18 @@ in
         description = "Directory to store downloads.";
       };
 
+      user = mkOption {
+        type = types.str;
+        default = "pyload";
+        description = "User under which pyLoad runs, and which owns the download directory.";
+      };
+
+      group = mkOption {
+        type = types.str;
+        default = "pyload";
+        description = "Group under which pyLoad runs, and which owns the download directory.";
+      };
+
       credentialsFile = mkOption {
         type = with types; nullOr path;
         default = null;
@@ -52,7 +64,7 @@ in
 
   config = lib.mkIf cfg.enable {
     systemd.tmpfiles.settings.pyload = {
-      ${cfg.downloadDirectory}.d = { };
+      ${cfg.downloadDirectory}.d = { inherit (cfg) user group; };
     };
 
     systemd.services.pyload = {
@@ -80,9 +92,8 @@ in
           cfg.downloadDirectory
         ];
 
-        User = "pyload";
-        Group = "pyload";
-        DynamicUser = true;
+        User = cfg.user;
+        Group = cfg.group;
 
         EnvironmentFile = lib.optional (cfg.credentialsFile != null) cfg.credentialsFile;
 
@@ -143,5 +154,13 @@ in
         ];
       };
     };
+
+    users.users.pyload = lib.mkIf (cfg.user == "pyload") {
+      isSystemUser = true;
+      group = cfg.group;
+      home = stateDir;
+    };
+
+    users.groups.pyload = lib.mkIf (cfg.group == "pyload") { };
   };
 }