From 2cb2759efc263eb4ad89fdb043a99984af4705d8 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Fri, 13 Dec 2024 13:28:45 -0600 Subject: [PATCH] adding syncthing as a desktop service --- home/home.nix | 26 +++++++++++++++- modules/desktop.nix | 49 +++++++++++++++++++++++++++++++ systems/dalinar/configuration.nix | 2 +- 3 files changed, 75 insertions(+), 2 deletions(-) diff --git a/home/home.nix b/home/home.nix index aa158f6..dddf52f 100644 --- a/home/home.nix +++ b/home/home.nix @@ -266,7 +266,31 @@ in # services.kdeconnect.enable = true; services = { - syncthing.enable = true; + syncthing = { + enable = false; + settings = { + devices = { + dalinar = { + id = "MPRMA33-XHW6SRE-D2EDBCP-TSMRNGI-ZCE2TAN-FE4BMKA-PSKGYJW-CRIEJQL"; + }; + }; + folders = { + "~/docs" = { + id = "docs"; + devices = [ "dalinar" ]; + versioning = { + type = "staggered"; + fsPath = "~/.local/syncthing/backup"; + params = { + cleanInterval = 3600; + maxAge = 31536000; + }; + }; + }; + }; + }; + tray = true; + }; easyeffects.enable = true; nextcloud-client = { enable = true; diff --git a/modules/desktop.nix b/modules/desktop.nix index d7c3036..7998c0c 100644 --- a/modules/desktop.nix +++ b/modules/desktop.nix @@ -1,5 +1,8 @@ { pkgs, lib, config, stable, ... }: +let + laptop = builtins.readFile "/etc/hostname" == "syl\n"; +in { # nix = { @@ -226,6 +229,52 @@ }; }; + services.syncthing = { + enable = true; + dataDir = "/home/chris/.local/share/syncthing"; + openDefaultPorts = true; + configDir = "/home/chris/.config/syncthing"; + user = "chris"; + group = "users"; + guiAddress = "0.0.0.0:8384"; + devices = { + syl = { + id = "AJMADOK-TENODAA-VSOEW2A-4RXY2XI-YNHIS7H-H3ZYAO5-3UQ64EE-O2N5BAY"; + }; + kaladin = { + id = "LH6523Z-QQ5F3A4-SINZDOI-UFMQBIX-ZV6Q5BQ-LTKVMDB-CRI6QG5-RRKJFQS"; + }; + shadow = { + id = "B24VU6Z-URTMEXN-ZYKRWX7-XWSTHXD-XKX67EB-XSKMT4V-KWKGX7Q-W7DB2QV"; + }; + tablet = { + id = "4HEXCNH-MCVBZQX-LQ735TG-P2VTJ7N-CZ5MK4P-ICZAPC7-YCXVEWV-7NILMA5"; + }; + kohlin = { + id = "BSWKBRR-2IJBCHA-UQY7DE7-CV2U2IL-PMFQFCJ-D5ZZJMU-FPYRUPC-MCC32QQ"; + }; + dalinar = { + id = "MPRMA33-XHW6SRE-D2EDBCP-TSMRNGI-ZCE2TAN-FE4BMKA-PSKGYJW-CRIEJQL"; + }; + }; + folders = { + docs = { + id = "docs"; + path = "/home/chris/docs"; + devices = [ (if laptop then "kaladin" else "syl") "shadow" "dalinar" ]; + versioning = { + type = "staggered"; + fsPath = "~/.local/syncthing/backup"; + params = { + cleanInterval = 3600; + maxAge = 31536000; + }; + }; + }; + }; + }; + + # Android Tools programs.adb.enable = true; services.udev.packages = [ pkgs.android-udev-rules ]; diff --git a/systems/dalinar/configuration.nix b/systems/dalinar/configuration.nix index 2578630..672ff35 100644 --- a/systems/dalinar/configuration.nix +++ b/systems/dalinar/configuration.nix @@ -103,7 +103,7 @@ ebooks = { id = "wziqy-7hyv9"; path = "/storage/syncthing/ebooks"; - devices = [ "syl" "kaladin" "shadow" "tablet" "kohlin"]; + devices = [ "kaladin" "shadow" "tablet" "kohlin"]; versioning = { type = "trashcan"; params.cleanoutDays = "100";