diff options
author | Aaron Andersen <aaron@fosslib.net> | 2021-12-07 16:46:50 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-07 16:46:50 -0500 |
commit | 7f6f59e43c63c406af8d0c234a7084c6aede96e3 (patch) | |
tree | fbc6f16688fa5fee892d5741f72e18526a4c3964 /nixos/modules/services/torrent/transmission.nix | |
parent | ec68e9736c682ebdaf227affe6d033694bfd5c6e (diff) | |
parent | b84beda44c25280736be85157bd9f267657a30bc (diff) | |
download | nixpkgs-7f6f59e43c63c406af8d0c234a7084c6aede96e3.tar nixpkgs-7f6f59e43c63c406af8d0c234a7084c6aede96e3.tar.gz nixpkgs-7f6f59e43c63c406af8d0c234a7084c6aede96e3.tar.bz2 nixpkgs-7f6f59e43c63c406af8d0c234a7084c6aede96e3.tar.lz nixpkgs-7f6f59e43c63c406af8d0c234a7084c6aede96e3.tar.xz nixpkgs-7f6f59e43c63c406af8d0c234a7084c6aede96e3.tar.zst nixpkgs-7f6f59e43c63c406af8d0c234a7084c6aede96e3.zip |
Merge pull request #147324 from ju1m/transmission
nixos/transmission: disable downloadDirPermissions by default
Diffstat (limited to 'nixos/modules/services/torrent/transmission.nix')
-rw-r--r-- | nixos/modules/services/torrent/transmission.nix | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/nixos/modules/services/torrent/transmission.nix b/nixos/modules/services/torrent/transmission.nix index b8b38f6ba93..9e440e49b50 100644 --- a/nixos/modules/services/torrent/transmission.nix +++ b/nixos/modules/services/torrent/transmission.nix @@ -167,13 +167,15 @@ in }; downloadDirPermissions = mkOption { - type = types.str; - default = "770"; - example = "775"; + type = with types; nullOr str; + default = null; + example = "770"; description = '' - The permissions set by <literal>systemd.activationScripts.transmission-daemon</literal> - on the directories <xref linkend="opt-services.transmission.settings.download-dir"/> - and <xref linkend="opt-services.transmission.settings.incomplete-dir"/>. + If not <code>null</code>, is used as the permissions + set by <literal>systemd.activationScripts.transmission-daemon</literal> + on the directories <xref linkend="opt-services.transmission.settings.download-dir"/>, + <xref linkend="opt-services.transmission.settings.incomplete-dir"/>. + and <xref linkend="opt-services.transmission.settings.watch-dir"/>. Note that you may also want to change <xref linkend="opt-services.transmission.settings.umask"/>. ''; @@ -246,15 +248,17 @@ in # when /home/foo is not owned by cfg.user. # Note also that using an ExecStartPre= wouldn't work either # because BindPaths= needs these directories before. - system.activationScripts.transmission-daemon = '' - install -d -m 700 '${cfg.home}/${settingsDir}' - chown -R '${cfg.user}:${cfg.group}' ${cfg.home}/${settingsDir} - install -d -m '${cfg.downloadDirPermissions}' -o '${cfg.user}' -g '${cfg.group}' '${cfg.settings.download-dir}' - '' + optionalString cfg.settings.incomplete-dir-enabled '' - install -d -m '${cfg.downloadDirPermissions}' -o '${cfg.user}' -g '${cfg.group}' '${cfg.settings.incomplete-dir}' - '' + optionalString cfg.settings.watch-dir-enabled '' - install -d -m '${cfg.downloadDirPermissions}' -o '${cfg.user}' -g '${cfg.group}' '${cfg.settings.watch-dir}' - ''; + system.activationScripts = mkIf (cfg.downloadDirPermissions != null) + { transmission-daemon = '' + install -d -m 700 '${cfg.home}/${settingsDir}' + chown -R '${cfg.user}:${cfg.group}' ${cfg.home}/${settingsDir} + install -d -m '${cfg.downloadDirPermissions}' -o '${cfg.user}' -g '${cfg.group}' '${cfg.settings.download-dir}' + '' + optionalString cfg.settings.incomplete-dir-enabled '' + install -d -m '${cfg.downloadDirPermissions}' -o '${cfg.user}' -g '${cfg.group}' '${cfg.settings.incomplete-dir}' + '' + optionalString cfg.settings.watch-dir-enabled '' + install -d -m '${cfg.downloadDirPermissions}' -o '${cfg.user}' -g '${cfg.group}' '${cfg.settings.watch-dir}' + ''; + }; systemd.services.transmission = { description = "Transmission BitTorrent Service"; @@ -313,6 +317,14 @@ in cfg.settings.script-torrent-done-filename ++ optional (cfg.settings.watch-dir-enabled && !cfg.settings.trash-original-torrent-files) cfg.settings.watch-dir; + StateDirectory = [ + "transmission" + "transmission/.config/transmission-daemon" + "transmission/.incomplete" + "transmission/Downloads" + "transmission/watch-dir" + ]; + StateDirectoryMode = mkDefault 750; # The following options are only for optimizing: # systemd-analyze security transmission AmbientCapabilities = ""; |