{ config, lib, pkgs, ... }:
with lib; {

  services.syncthing = {
    guiAddress = lib.mkDefault "${config.networking.hostName}.private:8384";
    overrideDevices = lib.mkDefault true;
    devices =
      let
        device = name: id: {
          "${name}" = {
            name = name;
            id = id;
            addresses = [ "tcp://${name}.private:22000" ];
          };
        };
      in
      {
        "robi" = {
          name = "robi";
          id = "B6P22RF-5BC2LTZ-6GHVWRZ-5D3OLXC-D66E45Y-JEB3WYT-ZQ442WZ-5FFAMQ7";
          addresses = [ "tcp://144.76.13.147:22000" ];
        };
      }
      // (device "workhorse" "AFSAKB6-JLH4QAS-DSRMPI3-6PVCIHF-IIAVLPC-STPNO3Y-YRDU5NW-QD445QI")
      // (device "pepe" "SZLXFW3-VTAC7UB-V2Z7CHE-3VZAYPL-6D72AK6-OCDMPZP-G4FPY5P-FL6ZVAG")
      // (device "sterni" "ZFNNKPD-ZSOAYJQ-VROXXDB-5MD3UTJ-GDCNTSQ-G5POVV3-UZG5HFT-CCAU3AD")
      // (device "mobi" "NGI7UN6-MR2YPYI-L7DGN3I-JFZU2N3-RJBJV6K-2VZVQSJ-PWLZYOK-PXZYRAF")
      // (device "bobi" "FOJ3D27-W5OJMQR-7S77A3V-AS5BCG2-CIGWVMP-UBSVQNN-QZLHAIZ-IO7GKAE")
      // (device "cream" "MQVKATH-THTPET5-KYAT7XX-BOIIIBA-P7OOF7Y-IWAUN53-S2VNVOY-BZWTGQK")
      // {
        bumba = {
          name = "windows-bumba";
          id = "JS7PWTO-VKFGBUP-GNFLSWP-MGFJ2KH-HLO2LKW-V3RPCR6-PCB5SQC-42FCKQZ";
        };
      }
      // {
        mors = {
          name = "lassulus-mors";
          id = "ZPRS57K-YK32ROQ-7A6MRAV-VOYXQ3I-CQCXISZ-C5PCV2A-GSFLG3I-K7UGGAH";
          addresses = [ "tcp://mors.r:22000" ];
        };
      };

    folders = {

      # needs to be on encrypted drives
      # -------------------------------
      private = {
        enable = lib.mkDefault false;
        watch = lib.mkDefault false;
        devices = [ "pepe" "cream" "sterni" "mobi" "bobi" ];
        versioning = {
          type = "simple";
          params.keep = "10";
        };
      };
      art = {
        enable = lib.mkDefault false;
        watch = lib.mkDefault false;
        devices = [ "pepe" "cream" "sterni" "bumba" ];
        versioning = {
          type = "simple";
          params.keep = "2";
        };
      };
      password-store = {
        enable = lib.mkDefault false;
        watch = lib.mkDefault false;
        devices = [ "pepe" "cream" "sterni" "mobi" "bobi" ];
        versioning = {
          type = "simple";
          params.keep = "10";
        };
      };
      desktop = {
        enable = lib.mkDefault false;
        watch = lib.mkDefault false;
        devices = [ "pepe" "cream" "sterni" "mobi" "bobi" ];
      };
      finance = {
        enable = lib.mkDefault false;
        watch = lib.mkDefault false;
        devices = [ "pepe" "cream" "sterni" "mobi" "bobi" ];
        versioning = {
          type = "simple";
          params.keep = "10";
        };
      };
      fotos = {
        enable = lib.mkDefault false;
        watch = lib.mkDefault false;
        devices = [ "pepe" ];
        versioning = {
          type = "simple";
          params.keep = "10";
        };
      };

      # no need to be stored on encrypted drives
      # ----------------------------------------
      lost-fotos = {
        enable = lib.mkDefault false;
        watch = lib.mkDefault false;
        devices = [ "pepe" "robi" ];
        versioning = {
          type = "simple";
          params.keep = "10";
        };
      };
      media = {
        enable = lib.mkDefault false;
        watch = lib.mkDefault false;
        devices = [ "pepe" "robi" ];
      };
      music-projects = {
        enable = lib.mkDefault false;
        id = "acfhu-r4t4f";
        watch = lib.mkDefault false;
        devices = [ "pepe" "cream" "sterni" "robi" ];
        versioning = {
          type = "simple";
          params.keep = "10";
        };
      };
      nextcloud_backup = {
        enable = lib.mkDefault false;
        watch = lib.mkDefault false;
        devices = [ "pepe" "robi" ];
        versioning = {
          type = "simple";
          params.keep = "2";
        };
      };
    };
  };

}