nix-configs

Personal NixOS and home-manager configuration files
Log | Files | Refs

syncthing.nix (962B)


      1 { vars, ... }:
      2 {
      3 
      4   services.syncthing = {
      5     enable = true;
      6     user = "${vars.user.username}";
      7     group = "users";
      8     dataDir = "/home/${vars.user.username}/";
      9     configDir = "/home/${vars.user.username}/.config/syncthing";
     10     settings = {
     11       options.urAccepted = 3;
     12       devices = builtins.mapAttrs (_: id: { inherit id; }) vars.syncthing;
     13       folders = {
     14         "/home/${vars.user.username}/vault" = {
     15       label = "vault";
     16             id = "vault";
     17             devices = builtins.attrNames vars.syncthing;
     18           };
     19         };
     20       };
     21     };
     22 
     23  # https://github.com/quic-go/quic-go/wiki/UDP-Buffer-Sizes
     24  boot.kernel.sysctl."net.core.rmem_max" = 7500000;
     25  boot.kernel.sysctl."net.core.wmem_max" = 7500000;
     26 
     27   # Disable default ~/Sync folder
     28   systemd.services.syncthing.environment.STNODEFAULTFOLDER = "true";
     29 
     30   # Firewall ports
     31   networking.firewall.allowedTCPPorts = [ 22000 ];
     32   networking.firewall.allowedUDPPorts = [ 22000 21027 ];
     33 
     34 }