nixos/transmission: Refactor out explicit listing of managed directories

This commit is contained in:
Corey O'Connor 2018-03-18 10:09:42 -07:00 committed by Bjørn Forsman
parent 9eec034d75
commit c0de2454bd

View File

@ -22,10 +22,13 @@ let
# for users in group "transmission" to have access to torrents
fullSettings = { umask = 2; download-dir = downloadDir; incomplete-dir = incompleteDir; } // cfg.settings;
# Directories transmission expects to exist and be ug+rwx.
directoriesToManage = [ homeDir settingsDir fullSettings.download-dir fullSettings.incomplete-dir ];
preStart = pkgs.writeScript "transmission-pre-start" ''
#!${pkgs.runtimeShell}
set -ex
for DIR in ${homeDir} ${settingsDir} ${fullSettings.download-dir} ${fullSettings.incomplete-dir}; do
for DIR in ${escapeShellArgs directoriesToManage}; do
mkdir -p "$DIR"
chmod 770 "$DIR"
done