dotfiles/nixos/syncthing.nix

63 lines
2.4 KiB
Nix
Raw Permalink Normal View History

2023-10-03 20:45:52 -06:00
{ makeEnable, config, ... }:
let
devices = {
2023-08-21 20:46:19 -06:00
adele = { id = "DAU7EFY-PDPH4H6-PIIWMPI-3CSTDZK-SZOINSZ-VCHOHGV-G54TEYD-A27S4QQ"; };
2023-08-03 23:08:00 -06:00
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"; };
2023-08-03 23:08:00 -06:00
pixel-7-pro = { id = "RZGPHX3-W5BPHLT-I4VLQVI-ZW4K7CE-X525NEN-XRG6MOH-GPEUXAD-4VG3XAR"; };
2023-08-04 01:36:57 -06:00
jay-lenovo-wsl = { id = "F3HW6DZ-B7BFACJ-SRAUM7Z-56TXQJ5-5WKZT5A-GKXAHVD-YLXFJ4M-G7OJQQC"; };
2023-08-05 12:34:58 -06:00
jay-lenovo = { id = "AP5ZUKJ-QBVYWCN-DYHR3UB-JJXRWNI-CAORGYM-HWRKHEH-ZJSTRLN-PP5USQX"; };
2023-10-03 20:45:52 -06:00
jimi-hendnix = { id = "55JWW5K-4NY5DKT-TR4MVPO-UNOMQKM-J7TYCRF-CCCZGPM-FVRKHID-JVFLAAV"; };
2023-11-18 18:58:51 -07:00
railbird-sf = { id = "5F4FPJM-KRBFVIH-CTTB2NC-7CPVGAM-CONMH2Q-SQPRODO-CWKRFPF-HVN4AAD"; };
dean = { id = "RIVW4FP-NZNGGGD-4ET26IC-R6CZHEU-4EBIDHX-U756VWB-W7EM3LE-3YQ6YA3"; };
2024-03-19 20:27:09 -06:00
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"; };
};
allDevices = builtins.attrNames devices;
in
makeEnable config "modules.syncthing" true {
2023-08-03 22:01:56 -06:00
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
2023-08-03 22:01:56 -06:00
'';
};
systemd.services.syncthing = {
serviceConfig = {
AmbientCapabilities = "CAP_CHOWN";
CapabilityBoundingSet = "CAP_CHOWN";
};
};
2023-08-03 21:26:28 -06:00
services.syncthing = {
enable = true;
settings = {
inherit devices;
2023-08-03 21:48:13 -06:00
folders = {
sync = {
2023-08-03 22:01:56 -06:00
path = "~/sync";
devices = allDevices;
ignorePerms = true;
copyOwnershipFromParent = true;
2023-08-03 21:48:13 -06:00
};
railbird = {
path = "~/railbird";
devices = allDevices;
ignorePerms = true;
copyOwnershipFromParent = true;
};
2023-08-03 21:48:13 -06:00
};
options = {
relaysEnabled = true;
localAnnounceEnabled = true;
};
2023-08-03 21:26:28 -06:00
};
};
}