permafrost/modules/syncthing.nix

73 lines
1.8 KiB
Nix
Raw Permalink Normal View History

2024-12-28 06:26:23 -08:00
{ config, lib, ... }:
with lib;
let
cfg = config.permafrost.syncthing;
in
{
options.permafrost.syncthing = {
enable = mkEnableOption "syncthing";
};
config = mkIf cfg.enable {
sops.secrets."syncthing/key" = { };
sops.secrets."syncthing/cert" = { };
2024-12-28 06:55:09 -08:00
networking.firewall.allowedTCPPorts = [
8384 # web gui port
];
2024-12-28 06:26:23 -08:00
services.syncthing =
let dataDir = config.services.syncthing.dataDir;
in {
enable = true;
user = "syncthing";
group = "syncthing";
dataDir = "/home/syncthing";
configDir = dataDir + "/config";
key = config.sops.secrets."syncthing/key".path;
cert = config.sops.secrets."syncthing/cert".path;
overrideFolders = true;
overrideDevices = true;
2024-12-28 07:04:53 -08:00
guiAddress = "0.0.0.0:8384";
openDefaultPorts = true;
2024-12-28 06:26:23 -08:00
settings = {
devices = {
snowhawk.id = "3KTMCOY-BUHLO4J-BMXBLEF-CFSXCS3-4YVOBTS-GKZMKNS-STR7CTT-37S2OQ2";
2024-12-28 06:50:28 -08:00
lynx.id = "O7EB4D6-AH4A53X-YM6UE7K-T3CJGIZ-MRJ6J7U-DXTEOKB-Z7LSV2M-LVUWFAO";
sprite.id = "IS2F2X5-43F7B2Q-SVSNY4J-GOHU5XP-NSJ2MJS-GDDNNTR-BGPQHHE-TE4JDAX";
2024-12-28 06:26:23 -08:00
};
folders = {
"obsidian" = rec {
id = "obsidian";
label = id;
path = dataDir + "/obsidian";
2024-12-28 06:50:28 -08:00
devices = [ "snowhawk" "lynx" "sprite" ];
2024-12-28 06:26:23 -08:00
};
"sync" = {
id = "default";
label = "sync";
path = dataDir + "/sync";
2024-12-28 06:50:28 -08:00
devices = [ "lynx" ];
2024-12-28 06:26:23 -08:00
};
};
gui.theme = "dark";
options = {
urAccepted = -1;
localAnnounceEnabled = false;
relaysEnabled = true;
};
};
};
};
}