From 624d5885f3571ed40893b39e5329d97c26d7e344 Mon Sep 17 00:00:00 2001 From: ediblerope Date: Thu, 22 Jan 2026 09:39:13 +0000 Subject: [PATCH] Update qbittorrent-nox.nix --- services/qbittorrent-nox.nix | 39 +++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/services/qbittorrent-nox.nix b/services/qbittorrent-nox.nix index 27d4d41..238b1d5 100644 --- a/services/qbittorrent-nox.nix +++ b/services/qbittorrent-nox.nix @@ -1,20 +1,33 @@ -#/services/qbittorrent-nox.nix +#qbittorrent-nox.nix { config, pkgs, lib, ... }: { config = lib.mkIf (config.networking.hostName == "FredOS-Mediaserver") { environment.systemPackages = with pkgs; [ 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 = { description = "qBittorrent-nox service"; after = [ "network.target" ]; wantedBy = [ "multi-user.target" ]; - serviceConfig = { Type = "simple"; User = "qbittorrent"; - Group = "qbittorrent"; + Group = "media"; # Changed to media ExecStart = "${pkgs.qbittorrent-nox}/bin/qbittorrent-nox"; Restart = "on-failure"; @@ -28,31 +41,21 @@ "/mnt/storage/torrents" ]; }; - preStart = '' mkdir -p /var/lib/qbittorrent/.config/qBittorrent cat > /var/lib/qbittorrent/.config/qBittorrent/qBittorrent.conf << EOF [Preferences] Downloads\SavePath=/mnt/storage/torrents/downloads 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 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 }; }