From e1e711ec17aa76510c5ab422ed7dd248d3cd33ec Mon Sep 17 00:00:00 2001 From: K900 Date: Wed, 25 Mar 2026 09:30:39 +0300 Subject: [PATCH] nixos/qbittorrent: just copy the config file in ourselves tmpfiles won't replace existing files, so we have to DIY it. Fixes #503103. --- nixos/modules/services/torrent/qbittorrent.nix | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/nixos/modules/services/torrent/qbittorrent.nix b/nixos/modules/services/torrent/qbittorrent.nix index 8ecfd98fde65..8c17fafc74b5 100644 --- a/nixos/modules/services/torrent/qbittorrent.nix +++ b/nixos/modules/services/torrent/qbittorrent.nix @@ -154,11 +154,6 @@ in mode = "755"; inherit (cfg) user group; }; - "${cfg.profileDir}/qBittorrent/config/qBittorrent.conf"."C+" = mkIf (cfg.serverConfig != { }) { - mode = "600"; - inherit (cfg) user group; - argument = toString configFile; - }; }; }; services.qbittorrent = { @@ -176,6 +171,12 @@ in Type = "simple"; User = cfg.user; Group = cfg.group; + + # the config file has to be writable, so we have to do this weird dance + ExecStartPre = lib.mkIf (cfg.serverConfig != { }) '' + ${pkgs.coreutils}/bin/install -Dm600 ${configFile} "${cfg.profileDir}/qBittorrent/config/qBittorrent.conf" + ''; + ExecStart = utils.escapeSystemdExecArgs ( [ (getExe cfg.package)