Refactor syncthing module

This commit is contained in:
SebastianStork 2025-03-17 19:07:52 +01:00
parent 3fb991b596
commit fcda8740bf

View file

@ -5,14 +5,12 @@
config = lib.mkIf config.myConfig.syncthing.enable { config = lib.mkIf config.myConfig.syncthing.enable {
services.syncthing = { services.syncthing = {
enable = true; enable = true;
openDefaultPorts = true;
user = "seb"; user = "seb";
group = "users"; group = "users";
dataDir = "/home/seb"; dataDir = "/home/seb";
overrideDevices = true;
overrideFolders = true;
settings = { settings = {
devices = { devices = {
north.id = "FAJS5WM-UAWGW2U-FXCGPSP-VAUOTGM-XUKSEES-D66PMCJ-WBODJLV-XTNCRA7"; north.id = "FAJS5WM-UAWGW2U-FXCGPSP-VAUOTGM-XUKSEES-D66PMCJ-WBODJLV-XTNCRA7";
@ -20,54 +18,24 @@
folders = folders =
let let
allDevices = [ genFolders =
"north" folders:
]; lib.genAttrs folders (name: {
staggeredVersioning = { path = "~/${name}";
type = "staggered"; ignorePerms = false;
params = { devices = [
cleanInterval = "3600"; # 1 hour in seconds "north"
maxAge = "15552000"; # 180 days in seconds ];
}; });
};
in in
{ genFolders [
Documents = { "Documents"
path = "/home/seb/Documents"; "Downloads"
devices = allDevices; "Music"
versioning = staggeredVersioning; "Pictures"
ignorePerms = false; "Projects"
}; "Videos"
Downloads = { ];
path = "/home/seb/Downloads";
devices = allDevices;
versioning = staggeredVersioning;
ignorePerms = false;
};
Pictures = {
path = "/home/seb/Pictures";
devices = allDevices;
versioning = staggeredVersioning;
ignorePerms = false;
};
Music = {
path = "/home/seb/Music";
devices = allDevices;
versioning = staggeredVersioning;
ignorePerms = false;
};
Videos = {
path = "/home/seb/Videos";
devices = allDevices;
versioning = staggeredVersioning;
ignorePerms = false;
};
Projects = {
path = "/home/seb/Projects";
devices = allDevices;
ignorePerms = false;
};
};
}; };
}; };
}; };