From 0325968f12a6b52c501eff9ebc10edb2e98248c1 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 28 Feb 2021 12:59:03 -0500 Subject: [PATCH] Polish mock syncthing config --- hosts/home.nix | 50 ++++++++++++++++++++++------------ hosts/kuro/default.nix | 2 +- modules/services/syncthing.nix | 4 +-- 3 files changed, 36 insertions(+), 20 deletions(-) diff --git a/hosts/home.nix b/hosts/home.nix index 899c8d81..fbd02ac2 100644 --- a/hosts/home.nix +++ b/hosts/home.nix @@ -29,21 +29,37 @@ with lib; # So thw bitwarden CLI knows where to find my server. modules.shell.bitwarden.config.server = "p.v0.io"; - services.syncthing.declarative = { - devices = { - kuro.id = "4UJSUBN-V7LCISG-6ZE7SBN-YPXM5FQ-CE7CD2U-W4KZC7O-4HUZZSW-6DXAGQQ"; - shiro.id = "G4DUO25-AMQQIWS-SRZE5TJ-43CCQZJ-5ULEZBS-P2LMZZU-V5JA5CS-6X7RLQK"; - kiiro.id = "DPQT4XQ-Q4APAYJ-T7P4KMY-YBLDKLC-7AU5Y4S-VGT3DDT-TMZZEIX-GBA7DAM"; - }; - folders = - let mkShare = name: devices: type: path: rec { - inherit devices type path; - watch = false; - rescanInterval = 3600 * 4; - enabled = lib.elem config.networking.hostname devices; - }; - in { - projects = mkShare "projects" [ "kuro" "shiro" ] "sendrecieve" "${config.user.home}/projects"; - }; - }; + + ## Not using syncthing atm + # services.syncthing.declarative = { + # # Purge folders not declaratively configured! + # overrideFolders = true; + # overrideDevices = true; + # devices = { + # kuro.id = "4UJSUBN-V7LCISG-6ZE7SBN-YPXM5FQ-CE7CD2U-W4KZC7O-4HUZZSW-6DXAGQQ"; + # shiro.id = "G4DUO25-AMQQIWS-SRZE5TJ-43CCQZJ-5ULEZBS-P2LMZZU-V5JA5CS-6X7RLQK"; + # kiiro.id = "3A6G2NR-WQMASWG-7EFUX6G-GJB6WYX-HYGDA7N-EYZYANY-NDRKI3W-32RQ4QG"; + # }; + # folders = + # let mkShare = devices: type: paths: attrs: (rec { + # inherit devices type; + # path = if lib.isAttrs paths + # then paths."${config.networking.hostName}" + # else paths; + # watch = false; + # rescanInterval = 3600; # every hour + # enable = lib.elem config.networking.hostName devices; + # } // attrs); + # in { + # projects = mkShare [ "kuro" "shiro" ] "sendreceive" # "${config.user.home}/projects" + # { watch = true; + # rescanInterval = 3600 * 4; }; # every 4 hours + # serverBackup = mkShare [ "ao" "kiiro" ] "sendonly" "/run/backups" + # mainBackup = mkShare [ "kuro" "kiiro" ] "sendreceive" # "/usr/store" + # { versioning = { + # type = "staggered"; + # params.maxAge = "356"; + # }; }; + # }; + # }; } diff --git a/hosts/kuro/default.nix b/hosts/kuro/default.nix index 9151891a..0cea4a56 100644 --- a/hosts/kuro/default.nix +++ b/hosts/kuro/default.nix @@ -76,7 +76,7 @@ networking.useDHCP = false; - ## Backups + # Syncthing is a bit heavy handed for my needs, so rsync to my NAS instead. systemd = { services.backups = { description = "Back up personal files"; diff --git a/modules/services/syncthing.nix b/modules/services/syncthing.nix index 41644822..f21a6fd5 100644 --- a/modules/services/syncthing.nix +++ b/modules/services/syncthing.nix @@ -13,8 +13,8 @@ in { enable = true; openDefaultPorts = true; user = config.user.name; - configDir = "/home/${user}/.config/syncthing"; - dataDir = "/home/${user}/.local/share/syncthing"; + configDir = "${config.user.home}/.config/syncthing"; + dataDir = "${config.user.home}/.local/share/syncthing"; }; }; }