Update qbittorrent-nox.nix
This commit is contained in:
parent
24f4bc3f25
commit
624d5885f3
1 changed files with 21 additions and 18 deletions
|
|
@ -1,20 +1,33 @@
|
||||||
#/services/qbittorrent-nox.nix
|
#qbittorrent-nox.nix
|
||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
{
|
{
|
||||||
config = lib.mkIf (config.networking.hostName == "FredOS-Mediaserver") {
|
config = lib.mkIf (config.networking.hostName == "FredOS-Mediaserver") {
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
qbittorrent-nox
|
qbittorrent-nox
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Create qbittorrent user with media group
|
||||||
|
users.users.qbittorrent = {
|
||||||
|
isSystemUser = true;
|
||||||
|
group = "media"; # Changed to media group for sharing
|
||||||
|
extraGroups = [ "media" ];
|
||||||
|
home = "/var/lib/qbittorrent";
|
||||||
|
createHome = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Create media group (shared with sonarr)
|
||||||
|
users.groups.media = {
|
||||||
|
gid = 3000;
|
||||||
|
};
|
||||||
|
|
||||||
systemd.services.qbittorrent-nox = {
|
systemd.services.qbittorrent-nox = {
|
||||||
description = "qBittorrent-nox service";
|
description = "qBittorrent-nox service";
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
User = "qbittorrent";
|
User = "qbittorrent";
|
||||||
Group = "qbittorrent";
|
Group = "media"; # Changed to media
|
||||||
ExecStart = "${pkgs.qbittorrent-nox}/bin/qbittorrent-nox";
|
ExecStart = "${pkgs.qbittorrent-nox}/bin/qbittorrent-nox";
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
|
|
||||||
|
|
@ -28,31 +41,21 @@
|
||||||
"/mnt/storage/torrents"
|
"/mnt/storage/torrents"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
preStart = ''
|
preStart = ''
|
||||||
mkdir -p /var/lib/qbittorrent/.config/qBittorrent
|
mkdir -p /var/lib/qbittorrent/.config/qBittorrent
|
||||||
cat > /var/lib/qbittorrent/.config/qBittorrent/qBittorrent.conf << EOF
|
cat > /var/lib/qbittorrent/.config/qBittorrent/qBittorrent.conf << EOF
|
||||||
[Preferences]
|
[Preferences]
|
||||||
Downloads\SavePath=/mnt/storage/torrents/downloads
|
Downloads\SavePath=/mnt/storage/torrents/downloads
|
||||||
EOF
|
EOF
|
||||||
chown -R qbittorrent:qbittorrent /var/lib/qbittorrent/.config
|
chown -R qbittorrent:media /var/lib/qbittorrent/.config
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
users.users.qbittorrent = {
|
|
||||||
isSystemUser = true;
|
|
||||||
group = "qbittorrent";
|
|
||||||
home = "/var/lib/qbittorrent";
|
|
||||||
createHome = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
users.groups.qbittorrent = {};
|
|
||||||
|
|
||||||
# Ensure the download directory exists with proper permissions
|
# Ensure the download directory exists with proper permissions
|
||||||
systemd.tmpfiles.rules = [
|
systemd.tmpfiles.rules = [
|
||||||
"d /mnt/storage/torrents/downloads 0775 qbittorrent qbittorrent -"
|
"d /mnt/storage/torrents/downloads 0775 qbittorrent media -"
|
||||||
];
|
];
|
||||||
|
|
||||||
users.users.fred.extraGroups = [ "qbittorrent" ];
|
users.users.fred.extraGroups = [ "media" ]; # Changed to media group
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue