linux: add syncthing

This commit is contained in:
Kate 2024-11-12 16:41:38 -07:00
parent 19c811a567
commit 7998307f77
2 changed files with 55 additions and 0 deletions

View file

@ -209,6 +209,7 @@
./nixos/configs/nix.nix
./nixos/configs/dotfiles
./nixos/configs/calendar.nix
./nixos/configs/syncthing.nix
./nixos/configs/include-conf.nix
./nixos/configs/flake-registry.nix
./nixos/configs/storage-optimization.nix

View file

@ -0,0 +1,54 @@
#
# 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";
};
}