nixos-config/components/network/syncthing.nix

156 lines
3.7 KiB
Nix
Raw Normal View History

2024-08-29 03:26:04 +02:00
{
config,
lib,
pkgs,
factsGenerator,
clanLib,
...
}:
with lib;
{
2019-10-24 02:20:38 +02:00
2024-06-05 18:37:31 +02:00
# networking.firewall.interfaces."gummybears".allowedTCPPorts = [ 8384 ];
2024-06-02 20:50:17 +02:00
2024-06-19 13:19:55 +02:00
clan.core.facts.services.syncthing = factsGenerator.syncthing { };
2024-06-04 09:13:35 +02:00
2020-11-21 18:56:11 +01:00
services.syncthing = {
2024-06-05 16:55:55 +02:00
guiAddress = lib.mkDefault "${config.networking.hostName}.private:8384";
2022-01-09 19:22:12 +01:00
overrideDevices = lib.mkDefault true;
2024-06-19 13:19:55 +02:00
key = config.clan.core.facts.services.syncthing.secret."syncthing.key".path;
cert = config.clan.core.facts.services.syncthing.secret."syncthing.cert".path;
2023-12-08 22:47:37 +01:00
settings.devices =
2022-01-09 19:22:12 +01:00
let
2024-08-29 03:06:27 +02:00
clanMachines =
lib.mapAttrs
(machine: facts: {
name = machine;
id = facts."syncthing.pub";
addresses = [ "tcp://[${facts."zerotier-ip"}]:22000" ];
})
2024-08-29 03:26:04 +02:00
(
clanLib.readFactsFromAllMachines [
"syncthing.pub"
"zerotier-ip"
]
);
2024-06-05 16:55:55 +02:00
device = machine: id: {
"${machine}" = {
name = machine;
2022-01-09 19:22:12 +01:00
id = id;
2024-06-05 16:55:55 +02:00
#addresses = [ "tcp://${machine}.private:22000" ];
2022-01-09 19:22:12 +01:00
};
};
in
2024-06-07 07:54:43 +02:00
clanMachines
2024-06-12 15:56:31 +02:00
// (device "iPhone" "RPQBSRB-DYEUUWQ-EAPMBA2-PL4MJ73-Y4F4ZTH-TAD7DUE-GEK56BG-HYW6YAF")
2024-10-07 07:50:56 +02:00
// (device "iPad" "NEGOJYU-EEDRM4E-XVZUKFO-63LAIOO-WHFFS2V-3SH3KR2-VYEFQLW-4QOFBQU")
2024-08-29 03:26:04 +02:00
// (device "bumba" "JS7PWTO-VKFGBUP-GNFLSWP-MGFJ2KH-HLO2LKW-V3RPCR6-PCB5SQC-42FCKQZ");
2019-10-24 02:20:38 +02:00
2023-12-08 22:47:37 +01:00
settings.folders = {
2019-10-25 03:03:25 +02:00
2024-04-17 10:00:17 +02:00
audiobooks = {
enable = lib.mkDefault false;
path = lib.mkDefault "/tmp/audiobooks";
2024-08-29 03:26:04 +02:00
devices = [
"chungus"
"orbi"
];
2024-04-17 10:00:17 +02:00
};
2023-05-12 11:17:58 +02:00
books = {
enable = lib.mkDefault false;
2023-12-08 21:27:52 +01:00
path = lib.mkDefault "/tmp/books";
2024-08-29 03:26:04 +02:00
devices = [
"chungus"
"cream"
"cherry"
];
2022-12-15 15:48:53 +01:00
versioning = {
type = "simple";
params.keep = "2";
};
};
2022-01-09 19:22:12 +01:00
desktop = {
enable = lib.mkDefault false;
2023-12-08 21:27:52 +01:00
path = lib.mkDefault "/tmp/desktop";
2024-08-29 03:26:04 +02:00
devices = [
"chungus"
"cream"
"cherry"
];
2022-01-09 19:22:12 +01:00
};
finance = {
enable = lib.mkDefault false;
2023-12-08 21:27:52 +01:00
path = lib.mkDefault "/tmp/finance";
2024-08-29 03:26:04 +02:00
devices = [
"chungus"
"cream"
"cherry"
];
2022-01-09 19:22:12 +01:00
versioning = {
type = "simple";
params.keep = "10";
2019-10-24 02:20:38 +02:00
};
2022-01-09 19:22:12 +01:00
};
2024-05-30 09:33:55 +02:00
flix = {
2022-01-09 19:22:12 +01:00
enable = lib.mkDefault false;
2024-05-30 09:33:55 +02:00
path = lib.mkDefault "/tmp/flix";
2024-08-29 03:26:04 +02:00
devices = [
"chungus"
"orbi"
];
2024-05-30 09:33:55 +02:00
};
logseq = {
enable = lib.mkDefault false;
path = lib.mkDefault "/tmp/logseq";
2024-08-29 03:26:04 +02:00
devices = [
"cherry"
2024-10-08 15:52:25 +02:00
"chungus"
"iPad"
2024-08-29 03:26:04 +02:00
"iPhone"
];
2024-05-30 09:33:55 +02:00
};
lectures = {
enable = lib.mkDefault false;
path = lib.mkDefault "/tmp/lectures";
2024-08-29 03:26:04 +02:00
devices = [
"chungus"
"orbi"
];
2024-05-30 09:33:55 +02:00
};
oscar_cpap = {
enable = lib.mkDefault false;
path = lib.mkDefault "/tmp/oscar_cpap";
2024-08-29 03:26:04 +02:00
devices = [
"chungus"
"cream"
"cherry"
];
2024-05-30 09:33:55 +02:00
};
password-store = {
enable = lib.mkDefault false;
path = lib.mkDefault "/tmp/password-store";
2024-08-29 03:26:04 +02:00
devices = [
"chungus"
"cream"
"cherry"
];
2022-01-09 19:22:12 +01:00
versioning = {
type = "simple";
2024-05-30 09:33:55 +02:00
params.keep = "10";
2019-10-24 02:20:38 +02:00
};
2022-01-09 19:22:12 +01:00
};
2024-06-10 15:11:48 +02:00
# to share big stuff public
share = {
enable = lib.mkDefault false;
path = lib.mkDefault "/tmp/password-store";
2024-08-29 03:26:04 +02:00
devices = [
"cream"
"cherry"
"orbi"
];
2024-06-10 15:11:48 +02:00
};
2019-10-24 02:20:38 +02:00
};
};
}