mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 16:21:34 +01:00
Refactor syncthing module
This commit is contained in:
parent
3fb991b596
commit
fcda8740bf
1 changed files with 18 additions and 50 deletions
|
|
@ -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;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue