{
  lib,
  pkgs,
  ...
}:
with lib; {
  services = {
    syncthing = {
      enable = true;
      systemService = true;
      overrideFolders = false;
      overrideDevices = false;
      openDefaultPorts = true;
      guiAddress = "127.0.0.1:8384";
      settings.options.urAccepted = -1;
      dataDir = "/mnt/export2179/syncthing";
      relay = {
        enable = true;
        pools = [];
        providedBy = "vps.posixlycorrect.com";
      };
    };
  };

  # calibre web stuff. make this better someday, this is pure duct-tape
  users.groups."calybresync".members = ["syncthing" "calibre-web"];
  systemd = {
    services."calybreown" = {
      script = ''
        chgrp -R calybresync /var/lib/calibre-web/calibre_library
        chmod -R g+w /var/lib/calibre-web/calibre_library
      '';
      serviceConfig.Type = "oneshot";
    };
    timers."calybreown" = {
      wantedBy = [
        "timers.target"
      ];
      timerConfig.OnCalendar = "*-*-* *:00/30:00";
    };
  };
}
