qbt change to user and group 06

This commit is contained in:
2025-07-22 14:01:03 +02:00
parent 173e9f8a04
commit f687534624
5 changed files with 39 additions and 32 deletions

View File

@@ -36,6 +36,7 @@ in {
"sonarr" "sonarr"
"radarr" "radarr"
"media" "media"
"share"
]; ];
}; };

View File

@@ -70,6 +70,5 @@ in {
group = cfg.group; group = cfg.group;
}; };
}; };
users.groups.media = {};
}; };
} }

View File

@@ -39,6 +39,8 @@ in {
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
services.${unit} = { services.${unit} = {
enable = true; enable = true;
user = srv.user;
group = srv.group;
}; };
services.caddy.virtualHosts."${cfg.url}" = { services.caddy.virtualHosts."${cfg.url}" = {
useACMEHost = srv.domain; useACMEHost = srv.domain;
@@ -46,16 +48,16 @@ in {
reverse_proxy http://127.0.0.1:8686 reverse_proxy http://127.0.0.1:8686
''; '';
}; };
users = { # users = {
users.lidarr = { # users.lidarr = {
uid = 306; # uid = 306;
group = "lidarr"; # group = "lidarr";
extraGroups = ["media"]; # extraGroups = ["media"];
isSystemUser = true; # isSystemUser = true;
}; # };
groups.lidarr = { # groups.lidarr = {
gid = 306; # gid = 306;
}; # };
}; # };
}; };
} }

View File

@@ -39,6 +39,8 @@ in {
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
services.${unit} = { services.${unit} = {
enable = true; enable = true;
user = srv.user;
group = srv.group;
}; };
services.caddy.virtualHosts."${cfg.url}" = { services.caddy.virtualHosts."${cfg.url}" = {
useACMEHost = srv.domain; useACMEHost = srv.domain;
@@ -46,10 +48,10 @@ in {
reverse_proxy http://127.0.0.1:9696 reverse_proxy http://127.0.0.1:9696
''; '';
}; };
users.users.prowlarr = { # users.users.prowlarr = {
group = "prowlarr"; # group = "prowlarr";
isSystemUser = true; # isSystemUser = true;
}; # };
users.groups.prowlarr = {}; # users.groups.prowlarr = {};
}; };
} }

View File

@@ -4,6 +4,9 @@
... ...
}: let }: let
cfg = config.server.qbittorrent; cfg = config.server.qbittorrent;
srv = config.server;
# uid = 899;
# gid = 777;
in { in {
options.server.qbittorrent = { options.server.qbittorrent = {
enable = lib.mkEnableOption "Enable qBittorrent"; enable = lib.mkEnableOption "Enable qBittorrent";
@@ -46,6 +49,7 @@ in {
virtualisation.oci-containers.containers = { virtualisation.oci-containers.containers = {
qbittorrent = { qbittorrent = {
user = "${srv.user}:${srv.group}";
image = "linuxserver/qbittorrent:latest"; image = "linuxserver/qbittorrent:latest";
autoStart = true; autoStart = true;
dependsOn = ["gluetun"]; dependsOn = ["gluetun"];
@@ -57,15 +61,15 @@ in {
"--network=container:gluetun" "--network=container:gluetun"
]; ];
volumes = [ volumes = [
"config:/var/lib/" "config:/var/lib/qbittorrent"
"downloads:/home/media/" "downloads:/home/media/downloads"
]; ];
environmentFiles = [ environmentFiles = [
config.age.secrets.gluetunEnv.path config.age.secrets.gluetunEnv.path
]; ];
environment = { environment = {
PUID = "899"; # PUID = toString uid;
PGID = "777"; # PGID = toString gid;
TZ = "Europe/Stockholm"; TZ = "Europe/Stockholm";
WEBUI_PORT = "${builtins.toString cfg.port}"; WEBUI_PORT = "${builtins.toString cfg.port}";
}; };
@@ -96,16 +100,15 @@ in {
}; };
}; };
users = { # users = {
users.qbittorrent = { # users.qbittorrent = {
uid = 899; # inherit uid;
group = "media"; # group = "qbittorrent";
# extraGroups = ["media"]; # isSystemUser = true;
isSystemUser = true; # };
}; # groups.qbittorrent = {
}; # inherit gid;
users.groups.media = { # };
gid = 777; # };
};
}; };
} }