Syncthing: Difference between revisions

Wrycode (talk | contribs)
m Add note about disabling default sync folder creation
Wrycode (talk | contribs)
Added 'declarative node IDs' section
Line 19: Line 19:


== Declarative configuration ==
== Declarative configuration ==
Note: using a declarative configuration will overwrite files in <code>configDir</code>.
You can declaratively set your Syncthing folders by using the <code>services.syncthing.devices</code> and  <code>services.syncthing.folders</code> options:
You can declaratively set your Syncthing folders by using the <code>services.syncthing.devices</code> and  <code>services.syncthing.folders</code> options:


Line 72: Line 74:
};
};
</syntaxHighlight>
</syntaxHighlight>
=== Declarative node IDs ===
If you set up Syncthing with the above configuration, you will still need to manually accept the connection from your other devices. If you want to make this automatic, you must also set the key.pem and cert.pem options:
<syntaxhighlight lang="nix">
services = {
  syncthing = {
    key = "/path/to/key.pem";
    cert = "/path/to/cert.pem";
    ...
};
</syntaxhighlight>This will ensure your node has a stable ID.
You can optionally include the key.pem and cert.pem files in the NixOS configuration using a tool like sops-nix. See [[Comparison of secret managing schemes]].


== Disable default sync folder ==
== Disable default sync folder ==