summaryrefslogtreecommitdiff
path: root/hosts/local/syncthing.nix
blob: 5497bc93fc54f34c29f3b3c1bdc4dce2edf9a275 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{
  inputs,
  pkgs,
  ...
}: {
  services.syncthing = {
    enable = true;
    openDefaultPorts = true;
    user = "y";
    dataDir = "/home/y/sync"; # default location for new folders
    # configDir = "/home/myusername/.config/syncthing";
    key = "/home/y/sync/key.pem";
    cert = "/home/y/sync/cert.pem";
    settings = {
      devices = {
        "phone" = {id = "TOBQJTK-QWVMMCN-7SJWXTL-FUKM4FB-ZTLGEL7-KEBTTB3-PC3WZOO-FLBW5A2 ";};
        "laptop" = {id = "INHTOYO-WNCIVPD-M27N2DY-2PJWVCV-FWYOCTQ-AWHBVIJ-4PRVAWR-E7PUTQ4";};
        # "desktop" = {id = "DEVICE-ID-GOES-HERE";};
      };
      folders = {
        "memes" = {
          path = "/home/y/sync/memes";
          devices = ["phone" "laptop"];
        };
        "creds" = {
          path = "/home/y/sync/creds";
          devices = ["phone" "laptop"];
          # By default, Syncthing doesn't sync file permissions. This line enables it for this folder.
          # ignorePerms = false;
        };
        "docs" = {
          path = "/home/y/sync/docs";
          devices = ["phone" "laptop"];
        };
        # "Sensitive" = {
        #   path = "/home/myusername/Sensitive";
        #   devices = [
        #     # We trust this device to have access
        #     # to the decrypted contents of this folder.
        #     "device1"
        #     # We do not trust this device, but we want to have another
        #     # (encrypted) copy of the data for redundancy/backup/sync purposes.
        #     {
        #       name = "device2";
        #       # encryptionPasswordFile is a path to a file containing the encryption password.
        #       # See below for information about managing secrets on NixOS.
        #       encryptionPasswordFile = "/run/secrets/st-sensitive-password";
        #     }
        #   ];
        # };
      };
    };
  };
}