summaryrefslogtreecommitdiff
path: root/os/srv/syncthing.nix
diff options
context:
space:
mode:
Diffstat (limited to 'os/srv/syncthing.nix')
-rw-r--r--os/srv/syncthing.nix47
1 files changed, 29 insertions, 18 deletions
diff --git a/os/srv/syncthing.nix b/os/srv/syncthing.nix
index 332bb54..b350428 100644
--- a/os/srv/syncthing.nix
+++ b/os/srv/syncthing.nix
@@ -6,39 +6,34 @@
}:
let
cfg = config.os.srv.syncthing;
+ syncDirs = lib.mapAttrsToList (_: folder: folder.path) config.services.syncthing.settings.folders;
in
{
options.os.srv.syncthing.enable = lib.mkEnableOption "enables syncthing syncing";
config = lib.mkIf cfg.enable {
+ systemd.tmpfiles.rules = map (path: "d ${path} 0755 ${username} users -") syncDirs;
+
services.syncthing = {
enable = true;
- user = "${username}";
+ user = username;
dataDir = "/home/${username}/.local/share/syncthing";
configDir = "/home/${username}/.config/syncthing";
- guiPasswordFile = "/run/secrets/syncthing/gui_password";
+ guiPasswordFile = config.sops.secrets."syncthing/gui_password".path;
settings = {
- devices = {
- "desktop" = {
- id = "YGMWGOB-LTJUDM7-CY25MAF-NPE7J4J-KYRNPB5-ZHD5DBI-VNRAXI6-LIP2DQP";
- };
- "laptop" = {
- id = "";
- };
- "thinkpad" = {
- id = "";
- };
- };
+ devices."oci".id = "DQXGVDC-KGPM6RK-5NDEBJJ-R7PEWYZ-N6Z3WFZ-TSVJG5X-235SHG4-4BEJNQJ";
+
folders = {
"game-saves" = {
path = "/home/${username}/.saves";
- id = "shared-saves-v1";
+ id = "game-saves";
devices = [
- "desktop"
- "laptop"
- "thinkpad"
+ {
+ name = "oci";
+ encryptionPasswordFile = config.sops.secrets."syncthing/encryption/game-saves".path;
+ compression = "always";
+ }
];
-
versioning = {
type = "staggered";
params = {
@@ -47,6 +42,22 @@ in
};
};
};
+
+ "keepass" = {
+ path = "/home/${username}/.keepass";
+ id = "keepass";
+ devices = [
+ {
+ name = "oci";
+ encryptionPasswordFile = config.sops.secrets."syncthing/encryption/keepass".path;
+ compression = "metadata";
+ }
+ ];
+ versioning = {
+ type = "simple";
+ params.keep = "10";
+ };
+ };
};
};
};