dotfiles/nixos/configs/syncthing.nix
2024-11-12 20:26:42 -07:00

54 lines
1.1 KiB
Nix

#
# All-device synchronization via Syncthing.
#
{ config, is-droid, ... }:
let
# The list of devices and their IDs.
devices = {
"valere" = { id = "VLZYF6C-OHG66RM-O72IMW3-S35YWAV-TYFJJVU-KAMJR7G-2XRLCVB-XOY6IAG"; };
"design" = { id = "XLTC5OX-3ZU6CYZ-MJ7TAY7-ZAMRIE4-SS2JWFB-FC3RJIO-B3BIQFV-J7U53QK"; };
};
#
in
{
services.syncthing = {
enable = !is-droid;
openDefaultPorts = true;
# Run as our user, and adopt our permissions.
user = "deprekated";
# Primary configuration.
settings = {
# Set up the webUI, accessible only via localhost.
gui = {
enabled = true;
address = "tcp://127.0.0.1:8384";
};
};
# Set up the devices that we allow to connect.
# See the big table above.
inherit devices;
# Set op our main sync'd folder.
folders."synced" = {
path = "/home/deprekated/synced";
devices = builtins.attrNames devices;
# Treat this like a sync'd folder that we always have acess to.
ignorePerms = true;
};
};
# Extra config passed through the environment.
systemd.services.syncthing.environment = {
STNODEFAULTFOLDER = "true";
};
}