mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-13 05:05:29 +03:00
nixos/pyload: add user/group options
This commit is contained in:
parent
61276c8099
commit
c14f029dae
1 changed files with 23 additions and 4 deletions
|
@ -34,6 +34,18 @@ in
|
||||||
description = "Directory to store downloads.";
|
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 {
|
credentialsFile = mkOption {
|
||||||
type = with types; nullOr path;
|
type = with types; nullOr path;
|
||||||
default = null;
|
default = null;
|
||||||
|
@ -52,7 +64,7 @@ in
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
systemd.tmpfiles.settings.pyload = {
|
systemd.tmpfiles.settings.pyload = {
|
||||||
${cfg.downloadDirectory}.d = { };
|
${cfg.downloadDirectory}.d = { inherit (cfg) user group; };
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.pyload = {
|
systemd.services.pyload = {
|
||||||
|
@ -80,9 +92,8 @@ in
|
||||||
cfg.downloadDirectory
|
cfg.downloadDirectory
|
||||||
];
|
];
|
||||||
|
|
||||||
User = "pyload";
|
User = cfg.user;
|
||||||
Group = "pyload";
|
Group = cfg.group;
|
||||||
DynamicUser = true;
|
|
||||||
|
|
||||||
EnvironmentFile = lib.optional (cfg.credentialsFile != null) cfg.credentialsFile;
|
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") { };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue