about summary refs log tree commit diff
path: root/nixos/modules/services/networking
diff options
context:
space:
mode:
authorBruno BELANYI <bruno@belanyi.fr>2024-02-04 13:29:46 +0000
committerBruno BELANYI <bruno@belanyi.fr>2024-02-08 20:27:14 +0000
commitc14f029dae7a6eba976549df6a787f9cbbfd444b (patch)
treec6a858a4d2f8aa8af3e9a3c2c05f591c3ca0be8f /nixos/modules/services/networking
parent61276c8099fbfc6d6ab72b9b2794cf22e9c9db45 (diff)
downloadnixlib-c14f029dae7a6eba976549df6a787f9cbbfd444b.tar
nixlib-c14f029dae7a6eba976549df6a787f9cbbfd444b.tar.gz
nixlib-c14f029dae7a6eba976549df6a787f9cbbfd444b.tar.bz2
nixlib-c14f029dae7a6eba976549df6a787f9cbbfd444b.tar.lz
nixlib-c14f029dae7a6eba976549df6a787f9cbbfd444b.tar.xz
nixlib-c14f029dae7a6eba976549df6a787f9cbbfd444b.tar.zst
nixlib-c14f029dae7a6eba976549df6a787f9cbbfd444b.zip
nixos/pyload: add user/group options
Diffstat (limited to 'nixos/modules/services/networking')
-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") { };
   };
 }