nixos/transmission: create user-provided download-dir, incomplete-dir
Currently only the hardcoded default directories are created, not the directories that the user may have provided. Fix that. [Bjørn: fix small typo (%{settingsDir} => ${settingsDir}) and change commit message.]
This commit is contained in:
parent
712d9f1e76
commit
09bdfd5c35
@ -21,7 +21,7 @@ let
|
|||||||
else toString ''"${x}"'';
|
else toString ''"${x}"'';
|
||||||
|
|
||||||
# for users in group "transmission" to have access to torrents
|
# for users in group "transmission" to have access to torrents
|
||||||
fullSettings = cfg.settings // { umask = 2; };
|
fullSettings = { download-dir = downloadDir; incomplete-dir = incompleteDir; } // cfg.settings // { umask = 2; };
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
@ -35,7 +35,7 @@ in
|
|||||||
Transmission daemon can be controlled via the RPC interface using
|
Transmission daemon can be controlled via the RPC interface using
|
||||||
transmission-remote or the WebUI (http://localhost:9091/ by default).
|
transmission-remote or the WebUI (http://localhost:9091/ by default).
|
||||||
|
|
||||||
Torrents are downloaded to ${homeDir}/Downloads/ by default and are
|
Torrents are downloaded to ${downloadDir} by default and are
|
||||||
accessible to users in the "transmission" group.
|
accessible to users in the "transmission" group.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
@ -83,7 +83,7 @@ in
|
|||||||
# 1) Only the "transmission" user and group have access to torrents.
|
# 1) Only the "transmission" user and group have access to torrents.
|
||||||
# 2) Optionally update/force specific fields into the configuration file.
|
# 2) Optionally update/force specific fields into the configuration file.
|
||||||
serviceConfig.ExecStartPre = ''
|
serviceConfig.ExecStartPre = ''
|
||||||
${pkgs.stdenv.shell} -c "chmod 770 ${homeDir} && mkdir -p ${settingsDir} ${downloadDir} ${incompleteDir} && rm -f ${settingsDir}/settings.json && cp -f ${settingsFile} ${settingsDir}/settings.json"
|
${pkgs.stdenv.shell} -c "mkdir -p ${homeDir} ${settingsDir} ${fullSettings.download-dir} ${fullSettings.incomplete-dir} && chmod 770 ${homeDir} ${settingsDir} ${fullSettings.download-dir} ${fullSettings.incomplete-dir} && rm -f ${settingsDir}/settings.json && cp -f ${settingsFile} ${settingsDir}/settings.json"
|
||||||
'';
|
'';
|
||||||
serviceConfig.ExecStart = "${pkgs.transmission}/bin/transmission-daemon -f --port ${toString config.services.transmission.port}";
|
serviceConfig.ExecStart = "${pkgs.transmission}/bin/transmission-daemon -f --port ${toString config.services.transmission.port}";
|
||||||
serviceConfig.ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
|
serviceConfig.ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user