Syncthing: Difference between revisions

Ponder (talk | contribs)
Bring firewall sentences together, likewise the GUI
Jooooscha (talk | contribs)
Declarative configuration: Add a section about how to add additional settings to syncthing
Line 1: Line 1:
Syncthing is a decentralized file synchronization service. You can use it to safely sync all files in a folder between different desktops/servers. In other Linux distributions you configure it via its own web-GUI. In NixOS you can partly or fully configure it using Nix.
Syncthing is a decentralized file synchronization service. You can use it to safely sync all files in a folder between different desktops/servers. In other Linux distributions, you configure it via its own web-GUI. In NixOS, you can partly or fully configure it using Nix.
== Install ==
== Install ==
Syncthing is available as a standalone package: <code>nix-env -iA nixos.syncthing</code>
Syncthing is available as a standalone package: <code>nix-env -iA nixos.syncthing</code>
Line 53: Line 53:
   };
   };
};
};
</syntaxHighlight>
</syntaxHighlight>Beware when adding additional settings via <code>services.syncthing.settings</code>, because sometimes you cannot use the key as in the documentation. For example, when setting the ''Sync Protocol Listen Address'': The key in the [https://docs.syncthing.net/users/config.html#config-file-format documentation] is <code>listenAddress</code>, however, because the value is a list the key used in <code>services.syncthing.settings</code> has to be <code>listenAddresses</code> (notice the extra <code>es</code>). See the following example:<syntaxhighlight lang="nix">
settings = {
  options = {
    listenAddresses = [ # listenAddress in the syncthing documentation
      "relay://replay-server/?id=<device-id>"
    ];
    globalAnnounceServers = [ # globalAnnounceServer in the syncthing documentation
      "https://relay-server/?id=<device-id>"
    ];
  };
};
 
</syntaxhighlight>


=== Firewall ===
=== Firewall ===