summary refs log tree commit diff
path: root/nixos/modules/services/torrent
diff options
context:
space:
mode:
authorDoron Behar <doron.behar@gmail.com>2020-08-15 21:45:34 +0300
committerDoron Behar <doron.behar@gmail.com>2020-08-16 12:43:02 +0300
commit22abe3202fb76b9640d0308a805e212e8c6eeab8 (patch)
tree2ee4c44f04a7a072311a67934b1dc65ca48c9f0e /nixos/modules/services/torrent
parent7acb961c670c49ccc5cd15774f7a205947f5efbc (diff)
downloadnixpkgs-22abe3202fb76b9640d0308a805e212e8c6eeab8.tar
nixpkgs-22abe3202fb76b9640d0308a805e212e8c6eeab8.tar.gz
nixpkgs-22abe3202fb76b9640d0308a805e212e8c6eeab8.tar.bz2
nixpkgs-22abe3202fb76b9640d0308a805e212e8c6eeab8.tar.lz
nixpkgs-22abe3202fb76b9640d0308a805e212e8c6eeab8.tar.xz
nixpkgs-22abe3202fb76b9640d0308a805e212e8c6eeab8.tar.zst
nixpkgs-22abe3202fb76b9640d0308a805e212e8c6eeab8.zip
nixos/transmission: handle watch-dir as incomplete-dir
`watch-dir` was neglected after #92106 - this change makes using this
setting work.
Diffstat (limited to 'nixos/modules/services/torrent')
-rw-r--r--nixos/modules/services/torrent/transmission.nix18
1 files changed, 17 insertions, 1 deletions
diff --git a/nixos/modules/services/torrent/transmission.nix b/nixos/modules/services/torrent/transmission.nix
index 92df46083ec..e0d116ff8e4 100644
--- a/nixos/modules/services/torrent/transmission.nix
+++ b/nixos/modules/services/torrent/transmission.nix
@@ -11,6 +11,7 @@ let
   settingsDir = ".config/transmission-daemon";
   downloadsDir = "Downloads";
   incompleteDir = ".incomplete";
+  watchDir = "watchdir";
   # TODO: switch to configGen.json once RFC0042 is implemented
   settingsFile = pkgs.writeText "settings.json" (builtins.toJSON cfg.settings);
 in
@@ -35,6 +36,8 @@ in
             download-dir = "${cfg.home}/${downloadsDir}";
             incomplete-dir = "${cfg.home}/${incompleteDir}";
             incomplete-dir-enabled = true;
+            watch-dir = "${cfg.home}/${watchDir}";
+            watch-dir-enabled = false;
             message-level = 1;
             peer-port = 51413;
             peer-port-random-high = 65535;
@@ -161,6 +164,9 @@ in
       { assertion = types.path.check cfg.settings.incomplete-dir;
         message = "`services.transmission.settings.incomplete-dir' must be an absolute path.";
       }
+      { assertion = types.path.check cfg.settings.watch-dir;
+        message = "`services.transmission.settings.watch-dir' must be an absolute path.";
+      }
       { assertion = cfg.settings.script-torrent-done-filename == "" || types.path.check cfg.settings.script-torrent-done-filename;
         message = "`services.transmission.settings.script-torrent-done-filename' must be an absolute path.";
       }
@@ -220,7 +226,11 @@ in
             cfg.settings.download-dir
           ] ++
           optional cfg.settings.incomplete-dir-enabled
-            cfg.settings.incomplete-dir;
+            cfg.settings.incomplete-dir
+          ++
+          optional cfg.settings.watch-dir-enabled
+            cfg.settings.watch-dir
+          ;
         BindReadOnlyPaths = [
           # No confinement done of /nix/store here like in systemd-confinement.nix,
           # an AppArmor profile is provided to get a confinement based upon paths and rights.
@@ -410,11 +420,17 @@ in
           ${optionalString cfg.settings.incomplete-dir-enabled ''
             rw ${cfg.settings.incomplete-dir}/**,
           ''}
+          ${optionalString cfg.settings.watch-dir-enabled ''
+            rw ${cfg.settings.watch-dir}/**,
+          ''}
           profile dirs {
             rw ${cfg.settings.download-dir}/**,
             ${optionalString cfg.settings.incomplete-dir-enabled ''
               rw ${cfg.settings.incomplete-dir}/**,
             ''}
+            ${optionalString cfg.settings.watch-dir-enabled ''
+              rw ${cfg.settings.watch-dir}/**,
+            ''}
           }
 
           ${optionalString (cfg.settings.script-torrent-done-enabled &&