From cec9f7acd5e5e365563212c5144394f71dd90b27 Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Sun, 3 Dec 2023 02:52:28 +0300 Subject: 2023-12-03 --- modules/nixos/syncthing.nix | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'modules/nixos/syncthing.nix') diff --git a/modules/nixos/syncthing.nix b/modules/nixos/syncthing.nix index 39579f8..ecc983f 100644 --- a/modules/nixos/syncthing.nix +++ b/modules/nixos/syncthing.nix @@ -12,6 +12,12 @@ in { options.nixfiles.modules.syncthing = { enable = mkEnableOption "Syncthing"; + port = mkOption { + description = "Port."; + type = with types; port; + default = 8384; + }; + domain = mkOption { description = "Domain name sans protocol scheme."; type = with types; str; @@ -41,15 +47,16 @@ in { user = my.username; inherit (config.my) group; - dataDir = config.my.home; + dataDir = "${config.dirs.config}/syncthing"; + configDir = config.services.syncthing.dataDir; - guiAddress = "127.0.0.1:8384"; + guiAddress = "127.0.0.1:${toString cfg.port}"; cert = config.secrets."syncthing-cert-${this.hostname}".path; key = config.secrets."syncthing-key-${this.hostname}".path; - overrideDevices = true; - overrideFolders = true; + overrideDevices = false; + overrideFolders = false; settings = { options = { @@ -70,8 +77,11 @@ in { devices = mapAttrs (name: attr: mkIf (attr.syncthing.id != null && hasAttr "wireguard" attr) { inherit (attr.syncthing) id; - addresses = ["tcp://${name}.${config.networking.domain}:22000"]; - introducer = this.isHeadless; + compression = "metadata"; + introducer = false; + address = "tcp://${name}.${config.networking.domain}:22000"; + autoAcceptFolders = true; + untrusted = false; }) my.configurations; @@ -107,17 +117,17 @@ in { versioning = trashcan; }; org = { - path = "${documents}/org"; # Configured by Emacs. + path = "${documents}/org"; devices = all; versioning = simple; }; roam = { - path = "${documents}/roam"; # Configured by Emacs. + path = "${documents}/roam"; devices = notOther; versioning = simple; }; elfeed = { - path = "${config.my.home}/.elfeed"; # Configured by Emacs. + path = "${config.my.home}/.elfeed"; devices = notOther; versioning = trashcan; }; -- cgit 1.4.1