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