summaryrefslogtreecommitdiff
path: root/hosts/muhammed/syncthing.nix
blob: 41613aa775b94282b49462da6f4adcab60f453e8 (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
{
  config,
  flakeInputs,
  ...
}: {
  # Until nix-community/home-manager@45c07fc becomes part of the channel we're
  # following, I've just manually included it here. When that time comes, the
  # module should be removed.
  imports = let
    home-manager' = builtins.fetchGit {
      url = "https://github.com/nix-community/home-manager.git";
      rev = "45c07fcf7d28b5fb3ee189c260dee0a2e4d14317";
    };
  in [
    "${home-manager'}/modules/services/syncthing.nix"
    flakeInputs.agenix.homeManagerModules.age
  ];
  disabledModules = ["services/syncthing.nix"];

  services.syncthing = {
    enable = true;

    key = config.age.secrets.syncthing-key.path;
    cert = config.age.secrets.syncthing-cert.path;

    settings = {
      folders = {
        "ebooks" = {
          lable = "Ebooks";
          path = "~/Documents/Synced ebooks";
          copyOwnershipFromParent = true;
          devices = ["boox-tablet"];
        };
      };

      devices = {
        boox-tablet.id = "SFQMOCB-TPRTXLD-WDL3REL-2XINQDR-3PZQ5IT-KX4PGXX-2VJO3JZ-2K2XNQ3";
      };
    };
  };

  # We store the keys as part of the configuration since the device id is based
  # on the key and we don't want that to change.
  age.secrets.syncthing-key.file = ../../secrets/syncthing-keys/muhammed/key.pem.age;
  age.secrets.syncthing-cert.file = ../../secrets/syncthing-keys/muhammed/cert.pem.age;
}