git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #95522 from doronbehar/fix/transmission

nixos/transmission: handle watch-dir

commit8b18e07c40f886ffc6bb91296f46ad5167967d08 authorJörg Thalheim <Mic92@users.noreply.github.com> dateMon 17 Aug 2020, 19:54 (6 years ago) parent914d37c22abe32
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.
@@ -408,11 +418,17 @@ in
408418 ${optionalString cfg.settings.incomplete-dir-enabled ''
409419 rw ${cfg.settings.incomplete-dir}/**,
410420 ''}
421+ ${optionalString cfg.settings.watch-dir-enabled ''
422+ rw ${cfg.settings.watch-dir}/**,
423+ ''}
411424 profile dirs {
412425 rw ${cfg.settings.download-dir}/**,
413426 ${optionalString cfg.settings.incomplete-dir-enabled ''
414427 rw ${cfg.settings.incomplete-dir}/**,
415428 ''}
429+ ${optionalString cfg.settings.watch-dir-enabled ''
430+ rw ${cfg.settings.watch-dir}/**,
431+ ''}
416432 }
417433
418434 ${optionalString (cfg.settings.script-torrent-done-enabled &&