From 36a08c5c26dbf146af762ca73f30cc336906540f Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Sun, 26 Apr 2026 22:31:34 -0700 Subject: [PATCH] Add mac-demarco-mini syncthing config --- nix-darwin/flake.nix | 1 + nix-darwin/home/syncthing.nix | 37 ++++++++++++ nix-shared/syncthing.nix | 26 +++++++++ nixos/syncthing.nix | 104 ++++++++++++++-------------------- 4 files changed, 108 insertions(+), 60 deletions(-) create mode 100644 nix-darwin/home/syncthing.nix create mode 100644 nix-shared/syncthing.nix diff --git a/nix-darwin/flake.nix b/nix-darwin/flake.nix index dbc52dec..3841485e 100644 --- a/nix-darwin/flake.nix +++ b/nix-darwin/flake.nix @@ -88,6 +88,7 @@ sharedHomeModules = [ ./home/common.nix ./home/git-sync.nix + ./home/syncthing.nix ]; homeForUser = user: "/Users/${user}"; configuration = { diff --git a/nix-darwin/home/syncthing.nix b/nix-darwin/home/syncthing.nix new file mode 100644 index 00000000..e4734c12 --- /dev/null +++ b/nix-darwin/home/syncthing.nix @@ -0,0 +1,37 @@ +{ + config, + lib, + pkgs, + ... +}: let + shared = import ../../nix-shared/syncthing.nix; + inherit (shared) devices allDevices; +in { + home.activation.ensureSyncthingDirectories = lib.hm.dag.entryAfter ["writeBoundary"] '' + /bin/mkdir -p "$HOME/Library/Logs/Syncthing" "$HOME/sync" "$HOME/railbird" + ''; + + services.syncthing = { + enable = true; + package = pkgs.syncthing; + settings = { + inherit devices; + folders = { + sync = { + path = "~/sync"; + devices = allDevices; + ignorePerms = true; + }; + railbird = { + path = "~/railbird"; + devices = allDevices; + ignorePerms = true; + }; + }; + options = { + relaysEnabled = true; + localAnnounceEnabled = true; + }; + }; + }; +} diff --git a/nix-shared/syncthing.nix b/nix-shared/syncthing.nix new file mode 100644 index 00000000..b02157b1 --- /dev/null +++ b/nix-shared/syncthing.nix @@ -0,0 +1,26 @@ +let + devices = { + adele = {id = "DAU7EFY-PDPH4H6-PIIWMPI-3CSTDZK-SZOINSZ-VCHOHGV-G54TEYD-A27S4QQ";}; + biskcomp = { + id = "PVGY6OH-WJEA5SD-SL5YI3F-72AZKVL-ZXHIWEW-D5V245P-VUM2BST-CH47JQD"; + addresses = ["tcp://192.168.1.44:22000" "tcp://1896Folsom.duckdns.org:22000"]; + }; + ryzen-shine = {id = "IYCR3JH-BDZ4N3F-ZBUETYR-4N2UILK-FAEJJ5B-YUYMZQ3-YN63E5T-I2EHCAK";}; + nixquick = {id = "6OAGJ3J-3P3R33R-ICHXDWX-IDDCUU7-ESN3Y65-2OGZMWL-R647V7N-4TA6IQM";}; + pixel-7-pro = {id = "RZGPHX3-W5BPHLT-I4VLQVI-ZW4K7CE-X525NEN-XRG6MOH-GPEUXAD-4VG3XAR";}; + jay-lenovo-wsl = {id = "F3HW6DZ-B7BFACJ-SRAUM7Z-56TXQJ5-5WKZT5A-GKXAHVD-YLXFJ4M-G7OJQQC";}; + jay-lenovo = {id = "AP5ZUKJ-QBVYWCN-DYHR3UB-JJXRWNI-CAORGYM-HWRKHEH-ZJSTRLN-PP5USQX";}; + jimi-hendnix = {id = "55JWW5K-4NY5DKT-TR4MVPO-UNOMQKM-J7TYCRF-CCCZGPM-FVRKHID-JVFLAAV";}; + railbird-sf = {id = "5F4FPJM-KRBFVIH-CTTB2NC-7CPVGAM-CONMH2Q-SQPRODO-CWKRFPF-HVN4AAD";}; + dean = {id = "RIVW4FP-NZNGGGD-4ET26IC-R6CZHEU-4EBIDHX-U756VWB-W7EM3LE-3YQ6YA3";}; + mixos = {id = "7DMMUDT-CO33EMS-LQW65MX-3BVYDBT-ZZWDJC6-SWEF6SW-ICUMWOE-ZC4IBQK";}; + strixi-minaj-wsl = {id = "DOAEFFI-W6EZY3K-GDUHDLX-6DQPVFC-XU3G65X-5KX6RKK-EMF7ZT7-YKKKOAM";}; + strixi-minaj = {id = "IF76WOS-WVYFAQG-ZZMIT3R-ZR6EQQH-YQP3FGZ-BJ3LJKO-56FK2XA-UREADQM";}; + dean-zephyrus = {id = "UVIQVZQ-WFWVUQT-OTXPK7V-RXFKAVV-RY5DV2Z-XZEH3Q2-JQZIQLW-XMSB6AT";}; + bencbox = {id = "FZFDBDG-J56RKLU-JZUHEAB-SAGB6CM-LRR6QFC-ZLNQG22-R2DEXAC-MY4BXQN";}; + mac-demarco-mini = {id = "ICRKXMI-74TTIAT-S4X24GH-GBCF5VU-XH4FA3Z-XQWJH5F-WWDH5FK-DHC5NAT";}; + }; +in { + inherit devices; + allDevices = builtins.attrNames devices; +} diff --git a/nixos/syncthing.nix b/nixos/syncthing.nix index 4f8c09c3..6dcd9a86 100644 --- a/nixos/syncthing.nix +++ b/nixos/syncthing.nix @@ -1,64 +1,48 @@ -{ makeEnable, config, ... }: -let - devices = { - adele = { id = "DAU7EFY-PDPH4H6-PIIWMPI-3CSTDZK-SZOINSZ-VCHOHGV-G54TEYD-A27S4QQ"; }; - biskcomp = { - id = "PVGY6OH-WJEA5SD-SL5YI3F-72AZKVL-ZXHIWEW-D5V245P-VUM2BST-CH47JQD"; - addresses = [ "tcp://192.168.1.44:22000" "tcp://1896Folsom.duckdns.org:22000" ]; - }; - ryzen-shine = { id = "IYCR3JH-BDZ4N3F-ZBUETYR-4N2UILK-FAEJJ5B-YUYMZQ3-YN63E5T-I2EHCAK"; }; - nixquick = { id = "6OAGJ3J-3P3R33R-ICHXDWX-IDDCUU7-ESN3Y65-2OGZMWL-R647V7N-4TA6IQM"; }; - pixel-7-pro = { id = "RZGPHX3-W5BPHLT-I4VLQVI-ZW4K7CE-X525NEN-XRG6MOH-GPEUXAD-4VG3XAR"; }; - jay-lenovo-wsl = { id = "F3HW6DZ-B7BFACJ-SRAUM7Z-56TXQJ5-5WKZT5A-GKXAHVD-YLXFJ4M-G7OJQQC"; }; - jay-lenovo = { id = "AP5ZUKJ-QBVYWCN-DYHR3UB-JJXRWNI-CAORGYM-HWRKHEH-ZJSTRLN-PP5USQX"; }; - jimi-hendnix = { id = "55JWW5K-4NY5DKT-TR4MVPO-UNOMQKM-J7TYCRF-CCCZGPM-FVRKHID-JVFLAAV"; }; - railbird-sf = { id = "5F4FPJM-KRBFVIH-CTTB2NC-7CPVGAM-CONMH2Q-SQPRODO-CWKRFPF-HVN4AAD"; }; - dean = { id = "RIVW4FP-NZNGGGD-4ET26IC-R6CZHEU-4EBIDHX-U756VWB-W7EM3LE-3YQ6YA3"; }; - mixos = { id = "7DMMUDT-CO33EMS-LQW65MX-3BVYDBT-ZZWDJC6-SWEF6SW-ICUMWOE-ZC4IBQK"; }; - strixi-minaj-wsl = { id = "DOAEFFI-W6EZY3K-GDUHDLX-6DQPVFC-XU3G65X-5KX6RKK-EMF7ZT7-YKKKOAM"; }; - strixi-minaj = { id = "IF76WOS-WVYFAQG-ZZMIT3R-ZR6EQQH-YQP3FGZ-BJ3LJKO-56FK2XA-UREADQM"; }; - dean-zephyrus = { id = "UVIQVZQ-WFWVUQT-OTXPK7V-RXFKAVV-RY5DV2Z-XZEH3Q2-JQZIQLW-XMSB6AT"; }; - bencbox = { id = "FZFDBDG-J56RKLU-JZUHEAB-SAGB6CM-LRR6QFC-ZLNQG22-R2DEXAC-MY4BXQN"; }; - }; - allDevices = builtins.attrNames devices; +{ + makeEnable, + config, + ... +}: let + shared = import ../nix-shared/syncthing.nix; + inherit (shared) devices allDevices; in -makeEnable config "myModules.syncthing" true { - system.activationScripts.syncthingPermissions = { - text = '' - chown -R syncthing:syncthing /var/lib/syncthing - chmod -R 2770 /var/lib/syncthing - mkdir -p /var/lib/syncthing/sync - mkdir -p /var/lib/syncthing/railbird - ''; - }; - systemd.services.syncthing = { - serviceConfig = { - AmbientCapabilities = "CAP_CHOWN"; - CapabilityBoundingSet = "CAP_CHOWN"; + makeEnable config "myModules.syncthing" true { + system.activationScripts.syncthingPermissions = { + text = '' + chown -R syncthing:syncthing /var/lib/syncthing + chmod -R 2770 /var/lib/syncthing + mkdir -p /var/lib/syncthing/sync + mkdir -p /var/lib/syncthing/railbird + ''; }; - }; - services.syncthing = { - enable = true; - settings = { - inherit devices; - folders = { - sync = { - path = "~/sync"; - devices = allDevices; - ignorePerms = true; - copyOwnershipFromParent = true; - }; - railbird = { - path = "~/railbird"; - devices = allDevices; - ignorePerms = true; - copyOwnershipFromParent = true; - }; - }; - options = { - relaysEnabled = true; - localAnnounceEnabled = true; + systemd.services.syncthing = { + serviceConfig = { + AmbientCapabilities = "CAP_CHOWN"; + CapabilityBoundingSet = "CAP_CHOWN"; }; }; - }; -} + services.syncthing = { + enable = true; + settings = { + inherit devices; + folders = { + sync = { + path = "~/sync"; + devices = allDevices; + ignorePerms = true; + copyOwnershipFromParent = true; + }; + railbird = { + path = "~/railbird"; + devices = allDevices; + ignorePerms = true; + copyOwnershipFromParent = true; + }; + }; + options = { + relaysEnabled = true; + localAnnounceEnabled = true; + }; + }; + }; + }