diff --git a/modules/nixos-modules/sync.nix b/modules/nixos-modules/sync.nix index f4bfbfc..a5e81ec 100644 --- a/modules/nixos-modules/sync.nix +++ b/modules/nixos-modules/sync.nix @@ -4,6 +4,7 @@ ... }: let mountDir = "/mnt/sync"; + configDir = "/etc/syncthing"; in { options.host.sync = { enable = lib.mkEnableOption "should sync thing be enabled on this device"; @@ -72,7 +73,7 @@ in { user = "syncthing"; group = "syncthing"; dataDir = "${mountDir}/default"; - configDir = "/etc/syncthing"; + configDir = configDir; overrideDevices = true; overrideFolders = true; settings = { @@ -165,6 +166,12 @@ in { } (lib.mkIf config.host.impermanence.enable { + assertions = [ + { + assertion = config.services.syncthing.configDir == configDir; + message = "syncthing config dir does not match persistence"; + } + ]; environment.persistence = { "/persist/system/root" = { enable = true; @@ -175,6 +182,11 @@ in { user = "syncthing"; group = "syncthing"; } + { + directory = configDir; + user = "syncthing"; + group = "syncthing"; + } ]; }; };