mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 21:01:34 +01:00
Sync folders between devices with syncthing
This commit is contained in:
parent
31e00e0481
commit
d67ad3a979
4 changed files with 63 additions and 0 deletions
|
|
@ -16,5 +16,6 @@
|
|||
./sound.nix
|
||||
./boot-loader.nix
|
||||
./printing.nix
|
||||
./syncthing.nix
|
||||
];
|
||||
}
|
||||
|
|
|
|||
60
modules/system/syncthing.nix
Normal file
60
modules/system/syncthing.nix
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
options.myConfig.syncthing.enable = lib.mkEnableOption "";
|
||||
|
||||
config = lib.mkIf config.myConfig.syncthing.enable {
|
||||
services.syncthing = {
|
||||
enable = true;
|
||||
|
||||
user = "seb";
|
||||
group = "users";
|
||||
dataDir = "/home/seb";
|
||||
|
||||
overrideDevices = true;
|
||||
overrideFolders = true;
|
||||
|
||||
settings = {
|
||||
devices = {
|
||||
seb-desktop.id = "DIPH5BN-N2XV57S-23W63KD-UZOZ3UI-RB24QRJ-VVPD4YM-ZMFZIXN-GPX4YA4";
|
||||
dell-laptop.id = "GUXHL6J-J2HWYNN-7JZJ5CN-6LPYGJD-H7GYRLQ-ORZ4PJJ-5K4WT7I-MELMIQO";
|
||||
};
|
||||
|
||||
folders = let
|
||||
devices = ["seb-desktop" "dell-laptop"];
|
||||
versioning = {
|
||||
type = "staggered";
|
||||
params = {
|
||||
cleanInterval = "3600"; # 1 hour in seconds
|
||||
maxAge = "15552000"; # 180 days in seconds
|
||||
};
|
||||
};
|
||||
ignorePerms = false;
|
||||
in {
|
||||
Documents = {
|
||||
path = "/home/seb/Documents";
|
||||
inherit devices versioning ignorePerms;
|
||||
};
|
||||
Downloads = {
|
||||
path = "/home/seb/Downloads";
|
||||
inherit devices versioning ignorePerms;
|
||||
};
|
||||
Pictures = {
|
||||
path = "/home/seb/Pictures";
|
||||
inherit devices versioning ignorePerms;
|
||||
};
|
||||
Music = {
|
||||
path = "/home/seb/Music";
|
||||
inherit devices versioning ignorePerms;
|
||||
};
|
||||
Videos = {
|
||||
path = "/home/seb/Videos";
|
||||
inherit devices versioning ignorePerms;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue