Add mac-demarco-mini syncthing config

This commit is contained in:
2026-04-26 22:31:34 -07:00
parent f15aea9a9c
commit 36a08c5c26
4 changed files with 108 additions and 60 deletions

View File

@@ -88,6 +88,7 @@
sharedHomeModules = [ sharedHomeModules = [
./home/common.nix ./home/common.nix
./home/git-sync.nix ./home/git-sync.nix
./home/syncthing.nix
]; ];
homeForUser = user: "/Users/${user}"; homeForUser = user: "/Users/${user}";
configuration = { configuration = {

View File

@@ -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;
};
};
};
}

26
nix-shared/syncthing.nix Normal file
View File

@@ -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;
}

View File

@@ -1,64 +1,48 @@
{ makeEnable, config, ... }: {
let makeEnable,
devices = { config,
adele = { id = "DAU7EFY-PDPH4H6-PIIWMPI-3CSTDZK-SZOINSZ-VCHOHGV-G54TEYD-A27S4QQ"; }; ...
biskcomp = { }: let
id = "PVGY6OH-WJEA5SD-SL5YI3F-72AZKVL-ZXHIWEW-D5V245P-VUM2BST-CH47JQD"; shared = import ../nix-shared/syncthing.nix;
addresses = [ "tcp://192.168.1.44:22000" "tcp://1896Folsom.duckdns.org:22000" ]; inherit (shared) devices allDevices;
};
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;
in in
makeEnable config "myModules.syncthing" true { makeEnable config "myModules.syncthing" true {
system.activationScripts.syncthingPermissions = { system.activationScripts.syncthingPermissions = {
text = '' text = ''
chown -R syncthing:syncthing /var/lib/syncthing chown -R syncthing:syncthing /var/lib/syncthing
chmod -R 2770 /var/lib/syncthing chmod -R 2770 /var/lib/syncthing
mkdir -p /var/lib/syncthing/sync mkdir -p /var/lib/syncthing/sync
mkdir -p /var/lib/syncthing/railbird mkdir -p /var/lib/syncthing/railbird
''; '';
};
systemd.services.syncthing = {
serviceConfig = {
AmbientCapabilities = "CAP_CHOWN";
CapabilityBoundingSet = "CAP_CHOWN";
}; };
}; systemd.services.syncthing = {
services.syncthing = { serviceConfig = {
enable = true; AmbientCapabilities = "CAP_CHOWN";
settings = { CapabilityBoundingSet = "CAP_CHOWN";
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;
}; };
}; };
}; 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;
};
};
};
}