Change:
Describe the bug transmission creates the download directory in extremely early boot before zfs mounts the filesystems . zfs then fails to mount a pool later with or something similar. To Reproduce Steps to reproduce the behavior: zfs, with secondary pools (from rootfs) transmission to use download directory in one of said secondary pools the system. Expected behavior transmission should wait for zfs pools to be mounted before attempting any of its initialization actions (especially when I have something like in my config. Notify maintainers Metadata system: host os: multi-user?: sandbox: version: channels(root): channels(nagisa): nixpkgs: Maintainer information:
Furthermore, I am not able to "just" override that behaviour AFAICT.
what user to you run as?
Whatever the default is, I think, which is . Perhaps also of note is that I'm running the transmission daemon, not the GUI things. For now I worked around it by setting , which makes the directory creation to fail.
After thinking this through using was a bad idea to work with directories. I have some ideas. I'll try and put something together this weekend if no one else gets around to it.
what if we only provision the state directory () if left as the default value. If the user specifies a custom value we rely on the sysadmin to provision the directory ahead of time with the appropriate permissions, etc... A very rough sketch of what that might look like .
another workaround could be to . well, I did by best to preserve the option because removing options often breaks users' config, but I personnally don't mind removing this one. Though I would like to get merged before changing things with this proposal.
That sounds good :+1:
I marked this as stale due to inactivity. &rarr;

Discussion:
}; downloadDirPermissions = mkOption { <del> type = types.str; default = "770"; example = "775"; </del> <ins> type = with types; nullOr str; default = null; example = "770"; </ins> description = '' <del> 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"/>. </del> <ins> 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"/>. </ins> Note that you may also want to change <xref linkend="opt-services.transmission.settings.umask"/>. '';

# 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. <del> 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}' ''; </del> <ins> 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}' ''; }; </ins> systemd.services.transmission = { description = "Transmission BitTorrent Service";

cfg.settings.script-torrent-done-filename ++ optional (cfg.settings.watch-dir-enabled && !cfg.settings.trash-original-torrent-files) cfg.settings.watch-dir; <ins> StateDirectory = [ "transmission" "transmission/.config/transmission-daemon" "transmission/.incomplete" "transmission/Downloads" "transmission/watch-dir" ]; StateDirectoryMode = mkDefault 750; </ins> # The following options are only for optimizing: # systemd-analyze security transmission AmbientCapabilities = "";