improve syncthing.nix

This commit is contained in:
Ingolf Wagner 2024-08-29 08:06:27 +07:00
parent 4c647291bc
commit 2bc86a4912
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
5 changed files with 8 additions and 45 deletions

View file

@ -1,14 +1,4 @@
{ config, lib, pkgs, factsGenerator, clanLib, ... }: { config, lib, pkgs, factsGenerator, clanLib, ... }:
let
clanMachines =
lib.mapAttrs
(machine: facts: {
name = machine;
id = facts."syncthing.pub";
addresses = [ "tcp://[${facts."zerotier-ip"}]:22000" ];
})
(clanLib.readFactsFromAllMachines [ "syncthing.pub" "zerotier-ip" ]);
in
with lib; { with lib; {
# networking.firewall.interfaces."gummybears".allowedTCPPorts = [ 8384 ]; # networking.firewall.interfaces."gummybears".allowedTCPPorts = [ 8384 ];
@ -22,6 +12,14 @@ with lib; {
cert = config.clan.core.facts.services.syncthing.secret."syncthing.cert".path; cert = config.clan.core.facts.services.syncthing.secret."syncthing.cert".path;
settings.devices = settings.devices =
let let
clanMachines =
lib.mapAttrs
(machine: facts: {
name = machine;
id = facts."syncthing.pub";
addresses = [ "tcp://[${facts."zerotier-ip"}]:22000" ];
})
(clanLib.readFactsFromAllMachines [ "syncthing.pub" "zerotier-ip" ]);
device = machine: id: { device = machine: id: {
"${machine}" = { "${machine}" = {
name = machine; name = machine;
@ -37,8 +35,6 @@ with lib; {
settings.folders = { settings.folders = {
# needs to be on encrypted drives
# -------------------------------
audiobooks = { audiobooks = {
enable = lib.mkDefault false; enable = lib.mkDefault false;
path = lib.mkDefault "/tmp/audiobooks"; path = lib.mkDefault "/tmp/audiobooks";
@ -102,16 +98,6 @@ with lib; {
path = lib.mkDefault "/tmp/password-store"; path = lib.mkDefault "/tmp/password-store";
devices = [ "cream" "cherry" "orbi" ]; devices = [ "cream" "cherry" "orbi" ];
}; };
# todo remove if zfs is is used
#nextcloud_backup = {
# enable = lib.mkDefault false;
# path = lib.mkDefault "/tmp/lost-fotos";
# devices = [ "chungus" ];
# versioning = {
# type = "simple";
# params.keep = "2";
# };
#};
}; };
}; };

View file

@ -1,6 +1,5 @@
{ config, pkgs, lib, ... }: { { config, pkgs, lib, ... }: {
services.syncthing = { services.syncthing = {
enable = true; enable = true;
openDefaultPorts = false; openDefaultPorts = false;
@ -10,9 +9,6 @@
configDir = "/home/palo/.syncthing"; configDir = "/home/palo/.syncthing";
overrideFolders = true; overrideFolders = true;
settings.folders = { settings.folders = {
# on encrypted drive
# ------------------
oscar_cpap = { oscar_cpap = {
enable = true; enable = true;
path = "/home/palo/Documents/OSCAR_Data"; path = "/home/palo/Documents/OSCAR_Data";
@ -42,9 +38,6 @@
path = "/home/palo/share"; path = "/home/palo/share";
type = "sendonly"; type = "sendonly";
}; };
# no need to be encrypted
# -----------------------
books = { books = {
enable = true; enable = true;
path = "/home/palo/books"; path = "/home/palo/books";

View file

@ -5,10 +5,7 @@
overrideFolders = true; overrideFolders = true;
user = "media"; user = "media";
group = "media"; group = "media";
# make some folders send only
settings.folders = { settings.folders = {
# on encrypted drive
# ------------------
oscar_cpap = { oscar_cpap = {
enable = true; enable = true;
path = "/syncthing/oscar_cpap"; path = "/syncthing/oscar_cpap";

View file

@ -10,9 +10,6 @@
configDir = "/home/palo/.syncthing"; configDir = "/home/palo/.syncthing";
overrideFolders = true; overrideFolders = true;
settings.folders = { settings.folders = {
# on encrypted drive
# ------------------
oscar_cpap = { oscar_cpap = {
enable = true; enable = true;
path = "/home/palo/Documents/OSCAR_Data"; path = "/home/palo/Documents/OSCAR_Data";
@ -25,10 +22,6 @@
enable = true; enable = true;
path = "/home/palo/logseq"; path = "/home/palo/logseq";
}; };
#private = {
# enable = true;
# path = "/home/palo/private";
#};
art = { art = {
enable = true; enable = true;
path = "/home/palo/art"; path = "/home/palo/art";
@ -46,9 +39,6 @@
path = "/home/palo/share"; path = "/home/palo/share";
type = "sendonly"; type = "sendonly";
}; };
# no need to be encrypted
# -----------------------
books = { books = {
enable = true; enable = true;
path = "/home/palo/books"; path = "/home/palo/books";

View file

@ -8,9 +8,6 @@
configDir = "/home/palo/.syncthing"; configDir = "/home/palo/.syncthing";
overrideFolders = true; overrideFolders = true;
folders = { folders = {
# on encrypted drive
# ------------------
private = { private = {
enable = true; enable = true;
path = "/home/palo/private"; path = "/home/palo/private";