diff --git a/hosts/pinwheel/configuration.nix b/hosts/pinwheel/configuration.nix index 1c1dc75..1ab8811 100644 --- a/hosts/pinwheel/configuration.nix +++ b/hosts/pinwheel/configuration.nix @@ -10,6 +10,7 @@ ./hardware-configuration.nix ./modules/age ./modules/ssh + ./modules/syncthing ]; nix.settings.experimental-features = [ "nix-command" "flakes" ]; @@ -124,95 +125,11 @@ }]; }; - services.syncthing = { - enable = true; - openDefaultPorts = true; - - cert = config.age.secrets.syncthing-cert.path; - key = config.age.secrets.syncthing-key.path; - - user = "alex"; - group = "users"; - - dataDir = "/home/alex/sync"; - - settings = { - devices = { - sombrero.id = "DIKHOMV-QGZV3DR-FXQZH45-I5J5R4R-JJZS5BA-XNNW5C7-QSSU3XV-KVC4MAQ"; - phone.id = "NJIMX57-C2CGV76-GXMAQYV-ABWDA7Z-TS6UV2X-NVL5UPG-UFEQH4C-TKYA6QM"; - }; - - folders = { - org = { - path = "/home/alex/sync/org"; - devices = [ "sombrero" "phone" ]; - versioning = { - type = "staggered"; - params = { - maxAge = "2592000"; # 30 days - }; - }; - }; - - personal = { - path = "/home/alex/sync/personal"; - devices = [ "sombrero" ]; - versioning = { - type = "staggered"; - params = { - maxAge = "2592000"; # 30 days - }; - }; - }; - - work = { - path = "/home/alex/sync/work"; - devices = [ "sombrero" ]; - versioning = { - type = "staggered"; - params = { - maxAge = "2592000"; # 30 days - }; - }; - }; - - "phone-gps" = { - path = "/home/alex/sync/phone-gps"; - devices = [ "phone" ]; - versioning = { - type = "staggered"; - params = { - maxAge = "2592000"; # 30 days - }; - }; - }; - - "time-tracking" = { - path = "/home/alex/sync/time-tracking"; - devices = [ "phone" ]; - versioning = { - type = "staggered"; - params = { - maxAge = "2592000"; # 30 days - }; - }; - }; - }; - }; - }; - security.pam.services.swaylock.text = '' # PAM configuration file for the swaylock screen locker. By default, it includes # the 'login' configuration file (see /etc/pam.d/login) auth include login ''; - - age = { - secrets = { - "syncthing-cert".file = ../../secrets/pinwheel/syncthing-cert.age; - "syncthing-key".file = ../../secrets/pinwheel/syncthing-key.age; - }; - }; # Open ports in the firewall. # networking.firewall.allowedTCPPorts = [ ... ]; diff --git a/hosts/pinwheel/modules/syncthing/default.nix b/hosts/pinwheel/modules/syncthing/default.nix new file mode 100644 index 0000000..6b1a929 --- /dev/null +++ b/hosts/pinwheel/modules/syncthing/default.nix @@ -0,0 +1,86 @@ +{ config, pkgs, ... }: +{ + services.syncthing = { + enable = true; + openDefaultPorts = true; + + cert = config.age.secrets.syncthing-cert.path; + key = config.age.secrets.syncthing-key.path; + + user = "alex"; + group = "users"; + + dataDir = "/home/alex/sync"; + + settings = { + devices = { + sombrero.id = "DIKHOMV-QGZV3DR-FXQZH45-I5J5R4R-JJZS5BA-XNNW5C7-QSSU3XV-KVC4MAQ"; + phone.id = "NJIMX57-C2CGV76-GXMAQYV-ABWDA7Z-TS6UV2X-NVL5UPG-UFEQH4C-TKYA6QM"; + }; + + folders = { + org = { + path = "/home/alex/sync/org"; + devices = [ "sombrero" "phone" ]; + versioning = { + type = "staggered"; + params = { + maxAge = "2592000"; # 30 days + }; + }; + }; + + personal = { + path = "/home/alex/sync/personal"; + devices = [ "sombrero" ]; + versioning = { + type = "staggered"; + params = { + maxAge = "2592000"; # 30 days + }; + }; + }; + + work = { + path = "/home/alex/sync/work"; + devices = [ "sombrero" ]; + versioning = { + type = "staggered"; + params = { + maxAge = "2592000"; # 30 days + }; + }; + }; + + "phone-gps" = { + path = "/home/alex/sync/phone-gps"; + devices = [ "phone" ]; + versioning = { + type = "staggered"; + params = { + maxAge = "2592000"; # 30 days + }; + }; + }; + + "time-tracking" = { + path = "/home/alex/sync/time-tracking"; + devices = [ "phone" ]; + versioning = { + type = "staggered"; + params = { + maxAge = "2592000"; # 30 days + }; + }; + }; + }; + }; + }; + + age = { + secrets = { + "syncthing-cert".file = ../../../../secrets/pinwheel/syncthing-cert.age; + "syncthing-key".file = ../../../../secrets/pinwheel/syncthing-key.age; + }; + }; +}