anchor.diff:    apparmor = config.security.apparmor.enable;
   
     homeDir = cfg.home;
  +  downloadDirPermissions = cfg.downloadDirPermissions;
     downloadDir = "${homeDir}/Downloads";
     incompleteDir = "${homeDir}/.incomplete";
   
  
positive.code: 
            See https://github.com/transmission/transmission/wiki/Editing-Configuration-Files
            for documentation.
          '';
        };
  
  
negative.code:   # for users in group "transmission" to have access to torrents
    fullSettings = { umask = 2; download-dir = downloadDir; incomplete-dir = incompleteDir; } // cfg.settings;
  
    preStart = pkgs.writeScript "transmission-pre-start" ''
      #!${pkgs.runtimeShell}
      set -ex
      for DIR in "${homeDir}" "${settingsDir}" "${fullSettings.download-dir}" "${fullSettings.incomplete-dir}"; do
        mkdir -p "$DIR"
      done
      chmod 700 "${homeDir}" "${settingsDir}"
      chmod ${downloadDirPermissions} "${fullSettings.download-dir}" "${fullSettings.incomplete-dir}"
      cp -f ${settingsFile} ${settingsDir}/settings.json
    '';
  in
  