nix/modules/nixos/services/syncthing/default.nix
Ameya Shenoy 4998e822a7 feat: init
Signed-off-by: Ameya Shenoy <shenoy.ameya@gmail.com>
2024-11-11 01:48:40 +05:30

49 lines
2 KiB
Nix

{ config, lib, ... }: {
options.snowflake.services.syncthing = {
enable = lib.mkEnableOption "enable garbage collection";
password = lib.mkOption { type = lib.types.str; };
user = lib.mkOption { type = lib.types.str; };
dataDir = lib.mkOption { type = lib.types.str; };
configDir = lib.mkOption { type = lib.types.str; };
};
config = lib.mkIf config.snowflake.services.syncthing.enable {
services = {
syncthing = {
enable = true;
user = config.snowflake.services.syncthing.user;
dataDir = config.snowflake.services.syncthing.dataDir;
configDir = config.snowflake.services.syncthing.configDir;
overrideDevices =
false; # overrides any devices added or deleted through the WebUI
overrideFolders =
false; # overrides any folders added or deleted through the WebUI
settings = {
options = {
urAccepted = -1; # prevent reporting anonymous usage analytics
};
gui = {
user = config.snowflake.services.syncthing.user;
password = config.snowflake.services.syncthing.password;
};
# unable to get the devices and folders bit working concistently.
# hence choosing to not do it manually for now
# reproducibility is the core issue, syncthing after every load asks if it can add the new device
# and it doesn't even request a sync of the folder
# devices = {
# "Kryo" = {
# id = "7EDU5MA-M3FEL4F-QWA35PH-MMW2KAL-6GS5CSH-2P7EIW0-4ZQNL37-I5F7CAM";
# };
# };
# folders = {
# "pkb-personal" = { # Name of folder in Syncthing, also the folder ID
# id = "kj6tu-lfx9f";
# path = "/home/cc/.pkb/personal"; # Which folder to add to Syncthing
# devices = [ "Kryo" ]; # Which devices to share the folder with
# };
# };
};
};
};
};
}