{
  pkgs,
  lib,
  config,
  ...
}: let
  program = "syncthing";
  cfg = config.dots.${program};
  sec = config.sops.secrets;
in {
  options.dots.${program} = {
    enable = lib.mkEnableOption "enables ${program}";
    host = lib.mkOption {
      type = lib.types.nullOr lib.types.str;
      default = null;
    };
  };

  config = lib.mkIf cfg.enable {

    services.${program} = {
      enable = true;
      #dataDir = "/var/lib/syncthing";
      guiAddress = "127.0.0.1:2222";
      #openDefaultPorts = true;
      overrideDevices = false;
      overrideFolders = false;
      extraOptions = ["--no-default-folder"];
      #key = sec."${program}/${cfg.host}/key".path;
      #cert = sec."${program}/${cfg.host}/cert".path;
      settings = {
        devices = {
          "snowbelle" = {id = "6WQ6ATA-5AT4RUM-NW67PAL-N62CPNV-ALRFG3P-5BDRO22-HWFC2Q4-5S5BDA5";};
          "lugia" = {id = "BKKSFPH-YEOVVAB-DTT7KK3-UDKAEJ2-PC6ECG7-Y76ZIVP-JRYMMXS-RTZYVQ3";};
          "zygarde" = {id = "UYLTF52-VVKUR7F-JN33HQZ-RFNWGL3-JER52LA-GZD2LPJ-QIFEE7K-MNMZRQ5";};
          "CEN-IT-07" = {id = "DPYKA4Z-3PX7JB2-FBEOXXX-SC7TLT2-QC5P2IR-SXOPJGX-QO3DMII-5B7UCA4";};
        };
        folders = {
          "holocron" = {
            path = "/home/blake/holocron";
            devices = ["lugia" "zygarde" "CEN-IT-07" "snowbelle"];
            id = "5voxg-c3he2";
            versioning = {
              type = "staggered";
              fsPath = "/home/blake/holocron/.stversions";
              params = {
                cleanInterval = "3600";
                maxAge = "0";
              };
            };

          };
        };
        options = {
          urAccepted = -1;
        };
      };

    };

    sops.secrets = {
      "${program}/${cfg.host}/key" = {};
      "${program}/${cfg.host}/cert" = {};
    }; 

  };
}
