Syncthing: Difference between revisions
imported>Klaymore m Comments for dataDir and configDir options |
imported>Klaymore Updated declarative configuration for 21.11 options changes, added note for earlier versions. |
||
| Line 21: | Line 21: | ||
== Declarative Configuration == | == Declarative Configuration == | ||
You can declaratively set your Syncthing folders by using the <code>services.syncthing. | You can declaratively set your Syncthing folders by using the <code>services.syncthing.devices</code> and <code>services.syncthing.folders</code> options: | ||
(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>) | |||
<nowiki> | <nowiki> | ||
| Line 27: | Line 29: | ||
syncthing = { | syncthing = { | ||
enable = true; | enable = true; | ||
overrideDevices = true; # overrides any devices added or deleted through the WebUI | |||
overrideFolders = true; # overrides any folders added or deleted through the WebUI | |||
devices = { | |||
"device1" = { id = "DEVICE-ID-GOES-HERE"; }; | |||
"device2" = { id = "DEVICE-ID-GOES-HERE"; }; | |||
}; | |||
folders = { | |||
"Documents" = { # Name of folder in Syncthing, also the folder ID | |||
path = "/home/myusername/Documents"; # Which folder to add to Syncthing | |||
devices = [ "device1" "device2" ]; # Which devices to share the folder with | |||
}; | }; | ||
"Example" = { | |||
path = "/home/myusername/Example"; | |||
devices = [ "device1" ]; | |||
ignorePerms = false; # By default, Syncthing doesn't sync file permissions. This line enables it for this folder. | |||
}; | }; | ||
}; | }; | ||