Syncthing: Difference between revisions
Jayman2000 (talk | contribs) →Disable default sync folder: Simplify code by using command-line argument instead of env var |
→System setup: Added information on how to open the firewall port so syncthing web gui is available through the network. |
||
| (One intermediate revision by one other user not shown) | |||
| Line 15: | Line 15: | ||
To install Syncthing as a system service that runs in the background and survives reboots, add the following to your <code>/etc/nixos/configuration.nix</code>: | To install Syncthing as a system service that runs in the background and survives reboots, add the following to your <code>/etc/nixos/configuration.nix</code>: | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"># Example for /etc/nixos/configuration.nix | ||
# Example for /etc/nixos/configuration.nix | |||
services.syncthing = { | services.syncthing = { | ||
enable = true; | enable = true; | ||
openDefaultPorts = true; # Open ports in the firewall for Syncthing | openDefaultPorts = true; # Open ports in the firewall for Syncthing. (NOTE: this will not open syncthing gui port) | ||
}; | };</syntaxhighlight> | ||
Once you've rebuilt your system, Syncthing will be available as a system service. You can visit http://127.0.0.1:8384/ to configure it through the web interface. | |||
If accessing the web interface from other networked computers you will need to open a tcp port:<syntaxhighlight lang="nix"> | |||
# port 8384 is the default port to allow access from the network. | |||
networking.firewall.allowedTCPPorts = [ 8384 ]; | |||
</syntaxhighlight> | </syntaxhighlight> | ||
== Configuration == | == Configuration == | ||
| Line 142: | Line 145: | ||
=== Disable default sync folder === | === Disable default sync folder === | ||
Syncthing creates a 'Sync' folder in your home directory every time it regenerates a configuration, even if your declarative configuration does not have this folder. You can disable that by using the <code>--no-default-folder</code> command-line option<ref>https://docs.syncthing.net/users/syncthing.html#cmdoption-no-default-folder</ref>: | Before version 2.0.0, Syncthing creates a 'Sync' folder in your home directory every time it regenerates a configuration, even if your declarative configuration does not have this folder. You can disable that by using the <code>--no-default-folder</code> command-line option<ref>https://docs.syncthing.net/users/syncthing.html#cmdoption-no-default-folder</ref>: | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
services.syncthing.extraFlags = [ "--no-default-folder" ]; # Don't create default ~/Sync folder | services.syncthing.extraFlags = [ "--no-default-folder" ]; # Don't create default ~/Sync folder | ||
</syntaxhighlight> | </syntaxhighlight>The default folder concept is removed in Syncthing 2.0.0 and this flag is no longer available.<ref>https://github.com/syncthing/syncthing/pull/10068</ref> | ||
== Troubleshooting == | == Troubleshooting == | ||