dotfiles/modules/nixos/syncthing.nix

28 lines
805 B
Nix

{
lib,
config,
...
}:
let
cfg = config.modules.syncthing;
in
{
options.modules.syncthing = {
enable = lib.mkOption { default = false; };
overrideSettings = lib.mkOption { default = false; };
};
config = lib.mkIf cfg.enable {
services.syncthing.enable = true;
services.syncthing.user = "julian";
services.syncthing.openDefaultPorts = true;
services.syncthing.configDir = "/home/julian/.config/syncthing";
services.syncthing.overrideDevices = cfg.overrideSettings; # overrides any devices added or deleted through the WebUI
services.syncthing.overrideFolders = cfg.overrideSettings; # overrides any folders added or deleted through the WebUI
systemd.services.syncthing.environment.STNODEFAULTFOLDER = "true"; # Don't create default ~/Sync folder
};
}