nixos/transmission: handle watch-dir as incomplete-dir
`watch-dir` was neglected after #92106 - this change makes using this setting work.
This commit is contained in:
parent
7acb961c67
commit
22abe3202f
@ -11,6 +11,7 @@ let
|
|||||||
settingsDir = ".config/transmission-daemon";
|
settingsDir = ".config/transmission-daemon";
|
||||||
downloadsDir = "Downloads";
|
downloadsDir = "Downloads";
|
||||||
incompleteDir = ".incomplete";
|
incompleteDir = ".incomplete";
|
||||||
|
watchDir = "watchdir";
|
||||||
# TODO: switch to configGen.json once RFC0042 is implemented
|
# TODO: switch to configGen.json once RFC0042 is implemented
|
||||||
settingsFile = pkgs.writeText "settings.json" (builtins.toJSON cfg.settings);
|
settingsFile = pkgs.writeText "settings.json" (builtins.toJSON cfg.settings);
|
||||||
in
|
in
|
||||||
@ -35,6 +36,8 @@ in
|
|||||||
download-dir = "${cfg.home}/${downloadsDir}";
|
download-dir = "${cfg.home}/${downloadsDir}";
|
||||||
incomplete-dir = "${cfg.home}/${incompleteDir}";
|
incomplete-dir = "${cfg.home}/${incompleteDir}";
|
||||||
incomplete-dir-enabled = true;
|
incomplete-dir-enabled = true;
|
||||||
|
watch-dir = "${cfg.home}/${watchDir}";
|
||||||
|
watch-dir-enabled = false;
|
||||||
message-level = 1;
|
message-level = 1;
|
||||||
peer-port = 51413;
|
peer-port = 51413;
|
||||||
peer-port-random-high = 65535;
|
peer-port-random-high = 65535;
|
||||||
@ -161,6 +164,9 @@ in
|
|||||||
{ assertion = types.path.check cfg.settings.incomplete-dir;
|
{ assertion = types.path.check cfg.settings.incomplete-dir;
|
||||||
message = "`services.transmission.settings.incomplete-dir' must be an absolute path.";
|
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;
|
{ 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.";
|
message = "`services.transmission.settings.script-torrent-done-filename' must be an absolute path.";
|
||||||
}
|
}
|
||||||
@ -220,7 +226,11 @@ in
|
|||||||
cfg.settings.download-dir
|
cfg.settings.download-dir
|
||||||
] ++
|
] ++
|
||||||
optional cfg.settings.incomplete-dir-enabled
|
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 = [
|
BindReadOnlyPaths = [
|
||||||
# No confinement done of /nix/store here like in systemd-confinement.nix,
|
# 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.
|
# 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 ''
|
${optionalString cfg.settings.incomplete-dir-enabled ''
|
||||||
rw ${cfg.settings.incomplete-dir}/**,
|
rw ${cfg.settings.incomplete-dir}/**,
|
||||||
''}
|
''}
|
||||||
|
${optionalString cfg.settings.watch-dir-enabled ''
|
||||||
|
rw ${cfg.settings.watch-dir}/**,
|
||||||
|
''}
|
||||||
profile dirs {
|
profile dirs {
|
||||||
rw ${cfg.settings.download-dir}/**,
|
rw ${cfg.settings.download-dir}/**,
|
||||||
${optionalString cfg.settings.incomplete-dir-enabled ''
|
${optionalString cfg.settings.incomplete-dir-enabled ''
|
||||||
rw ${cfg.settings.incomplete-dir}/**,
|
rw ${cfg.settings.incomplete-dir}/**,
|
||||||
''}
|
''}
|
||||||
|
${optionalString cfg.settings.watch-dir-enabled ''
|
||||||
|
rw ${cfg.settings.watch-dir}/**,
|
||||||
|
''}
|
||||||
}
|
}
|
||||||
|
|
||||||
${optionalString (cfg.settings.script-torrent-done-enabled &&
|
${optionalString (cfg.settings.script-torrent-done-enabled &&
|
||||||
|
Loading…
x
Reference in New Issue
Block a user