~ruther/nixos-config

ref: e09f66ea4c31e95a365292a03d39ef3ffcda608b nixos-config/modules/services/syncthing.nix -rw-r--r-- 1.1 KiB
e09f66ea — Rutherther fix: add necessary firewall syncthing settings 1 year, 6 months ago
                                                                                
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
{ config, lib, pkgs, user, ... }:

{
  networking.firewall = {
    allowedTCPPorts = [ 22000 ];
    allowedUDPPorts = [ 22000 21027 ];
  };

  services.syncthing = {
    enable = true;
    user = "${user}";
    configDir = "/home/${user}/.config/syncthing";
    overrideDevices = true;
    overrideFolders = true;
    devices = {
      "phone" = { id = inputs.semi-secrets.syncthing.devices.phone; };
    };
    folders = {
      "University" = {
        path = "/home/${user}/Documents/uni";
        devices = [ "phone" ];
      };
      "Notes" = {
        path = "/home/${user}/Documents/notes/obsidian/Notes";
        devices = [ "phone" ];
      };
      "Camera" = {
        path = "/home/${user}/Documents/camera";
        devices = [ "phone" ];
      };
      "study" = {
        path = "/home/${user}/Documents/study";
        devices = [ "phone" ];
      };
    };
    extraOptions.options = {
      natenabled = false;
      relaysEnabled = false;
      globalAnnounceEnabled = false;
      localAnnounceEnabled = true;
      #alwaysLocalNets = true;
    };
  };
}
Do not follow this link