git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/transmission: handle watch-dir as incomplete-dir

`watch-dir` was neglected after #92106 - this change makes using this setting work.

commit22abe3202fb76b9640d0308a805e212e8c6eeab8 authorDoron Behar <doron.behar@gmail.com> dateSat 15 Aug 2020, 21:45 (6 years ago) parent7acb961
1 file changed+17−1
nixos/modules/services/torrent/transmission.nix+17−1
nixos/modules/services/torrent/transmission.nix+17−1
@@ -11,6 +11,7 @@ let
1111 settingsDir = ".config/transmission-daemon";
1212 downloadsDir = "Downloads";
1313 incompleteDir = ".incomplete";
14+ watchDir = "watchdir";
1415 # TODO: switch to configGen.json once RFC0042 is implemented
1516 settingsFile = pkgs.writeText "settings.json" (builtins.toJSON cfg.settings);
1617in
@@ -35,6 +36,8 @@ in
3536 download-dir = "${cfg.home}/${downloadsDir}";
3637 incomplete-dir = "${cfg.home}/${incompleteDir}";
3738 incomplete-dir-enabled = true;
39+ watch-dir = "${cfg.home}/${watchDir}";
40+ watch-dir-enabled = false;
3841 message-level = 1;
3942 peer-port = 51413;
4043 peer-port-random-high = 65535;
@@ -161,6 +164,9 @@ in
161164 { assertion = types.path.check cfg.settings.incomplete-dir;
162165 message = "`services.transmission.settings.incomplete-dir' must be an absolute path.";
163166 }
167+ { assertion = types.path.check cfg.settings.watch-dir;
168+ message = "`services.transmission.settings.watch-dir' must be an absolute path.";
169+ }
164170 { assertion = cfg.settings.script-torrent-done-filename == "" || types.path.check cfg.settings.script-torrent-done-filename;
165171 message = "`services.transmission.settings.script-torrent-done-filename' must be an absolute path.";
166172 }
@@ -220,7 +226,11 @@ in
220226 cfg.settings.download-dir
221227 ] ++
222228 optional cfg.settings.incomplete-dir-enabled
223− cfg.settings.incomplete-dir;
229+ cfg.settings.incomplete-dir
230+ ++
231+ optional cfg.settings.watch-dir-enabled
232+ cfg.settings.watch-dir
233+ ;
224234 BindReadOnlyPaths = [
225235 # No confinement done of /nix/store here like in systemd-confinement.nix,
226236 # an AppArmor profile is provided to get a confinement based upon paths and rights.
@@ -410,11 +420,17 @@ in
410420 ${optionalString cfg.settings.incomplete-dir-enabled ''
411421 rw ${cfg.settings.incomplete-dir}/**,
412422 ''}
423+ ${optionalString cfg.settings.watch-dir-enabled ''
424+ rw ${cfg.settings.watch-dir}/**,
425+ ''}
413426 profile dirs {
414427 rw ${cfg.settings.download-dir}/**,
415428 ${optionalString cfg.settings.incomplete-dir-enabled ''
416429 rw ${cfg.settings.incomplete-dir}/**,
417430 ''}
431+ ${optionalString cfg.settings.watch-dir-enabled ''
432+ rw ${cfg.settings.watch-dir}/**,
433+ ''}
418434 }
419435
420436 ${optionalString (cfg.settings.script-torrent-done-enabled &&