Syncthing: Difference between revisions
m →Declarative configuration: Adding documentation that helped me a lot with setting up Syncthing. |
m Added label field in example for folder field |
||
| Line 27: | Line 27: | ||
(Note: Before NixOS 21.11, declarative configuration was done in the <code>services.syncthing.declarative</code> option, such as <code>services.syncthing.declarative.folders = {};</code>) | (Note: Before NixOS 21.11, declarative configuration was done in the <code>services.syncthing.declarative</code> option, such as <code>services.syncthing.declarative.folders = {};</code>) | ||
< | <syntaxhighlight lang="nix"> | ||
services = { | services = { | ||
syncthing = { | syncthing = { | ||
| Line 42: | Line 42: | ||
}; | }; | ||
folders = { | folders = { | ||
"Documents" = { # | "Documents" = { # Folder ID in Syncthing, also the name of folder (label) by default | ||
path = "/home/myusername/Documents"; # Which folder to add to Syncthing | path = "/home/myusername/Documents"; # Which folder to add to Syncthing | ||
devices = [ "device1" "device2" ]; # Which devices to share the folder with | devices = [ "device1" "device2" ]; # Which devices to share the folder with | ||
}; | }; | ||
"Example" = { | "Example" = { | ||
label = "Private"; # Optional label for the folder | |||
path = "/home/myusername/Example"; | path = "/home/myusername/Example"; | ||
devices = [ "device1" ]; | devices = [ "device1" ]; | ||
| Line 55: | Line 56: | ||
}; | }; | ||
}; | }; | ||
</ | </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 = { | settings = { | ||
options = { | options = { | ||