2023-07-26 11:36:54 +03:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
myData,
|
|
|
|
...
|
|
|
|
}: let
|
2023-10-01 23:14:05 +03:00
|
|
|
cfg = config.mj.services.syncthing;
|
|
|
|
|
2023-07-26 11:36:54 +03:00
|
|
|
guiPort = 8384;
|
2023-09-18 12:38:17 +03:00
|
|
|
devices = {
|
|
|
|
"fwminex".id = "GKSUKZE-AOBQOWY-CNLZ2ZI-WNKATYE-MV4Y452-J3VCJ5C-EAANXRX-2P6EHA6";
|
|
|
|
"vno1-oh2".id = "W45ROUW-CHKI3I6-C4VCOCU-NJYQ3ZS-MJDHH23-YYCDXTI-HTJSBZJ-KZMWTAF";
|
|
|
|
"mxp10".id = "LO54QZZ-5J3G62P-WUVM3MW-7J3VWHD-BG76TOQ-5S7PZSY-JU45K3I-X3ZL4AN";
|
|
|
|
"rzj-744P2PE".id = "UW6ISH2-NW6X6AW-BJR76TV-TV3BIGZ-PA5QH2M-YEF567T-IWMHKD5-P3XHHAH";
|
|
|
|
"KrekenavosNamai".id = "CYZDYL6-YMW7SZ3-K6IJO4Q-6NOULSG-OVZ3BGN-6LN3CLR-P3BJFKW-2PMHJQT";
|
2023-09-18 12:46:46 +03:00
|
|
|
"vno1-vinc".id = "4W3S7R2-OWI6XO6-V4NMDNB-NTIETYP-QJSBQGA-WEIXPHR-WNZZ7R4-VT4COAR";
|
2023-09-18 12:47:51 +03:00
|
|
|
"vno2-irena".id = "VL2MA2E-ZDGVHYN-A3Q3EKU-7J625QM-FG7CNXY-UKDL563-MDRRIEG-XQDS3AW";
|
2023-09-18 12:38:17 +03:00
|
|
|
};
|
2023-09-18 12:13:09 +03:00
|
|
|
folders = {
|
|
|
|
Books = {
|
2023-10-08 23:22:07 +03:00
|
|
|
devices = ["fwminex" "vno1-oh2" "mxp10"];
|
2023-09-18 12:13:09 +03:00
|
|
|
id = "8lk0n-mm63y";
|
|
|
|
label = "Books";
|
|
|
|
};
|
|
|
|
M-Active = {
|
|
|
|
devices = ["mxp10" "fwminex" "vno1-oh2"];
|
|
|
|
id = "f6fma-unkxq";
|
|
|
|
label = "M-Active";
|
|
|
|
};
|
2023-09-18 12:38:17 +03:00
|
|
|
M-Documents = {
|
|
|
|
devices = ["fwminex" "vno1-oh2"];
|
|
|
|
id = "4fu7z-z6es2";
|
|
|
|
label = "M-Documents";
|
|
|
|
};
|
|
|
|
M-Camera = {
|
|
|
|
devices = ["mxp10" "fwminex" "vno1-oh2"];
|
|
|
|
id = "pixel_xl_dtm3-photos";
|
|
|
|
label = "M-Active";
|
|
|
|
};
|
|
|
|
R-Documents = {
|
|
|
|
devices = ["rzj-744P2PE" "vno1-oh2"];
|
|
|
|
id = "nm23h-aog6k";
|
|
|
|
label = "R-Documents";
|
|
|
|
};
|
|
|
|
Pictures = {
|
|
|
|
devices = ["fwminex" "vno1-oh2"];
|
|
|
|
id = "d3hur-cbzyw";
|
|
|
|
label = "Pictures";
|
|
|
|
};
|
2023-09-18 12:44:09 +03:00
|
|
|
Music = {
|
|
|
|
devices = ["fwminex" "mxp10" "vno1-oh2"];
|
|
|
|
id = "tg94v-cqcwr";
|
|
|
|
label = "music";
|
|
|
|
};
|
|
|
|
video-shared = {
|
|
|
|
devices = ["mxp10" "fwminex" "vno1-oh2"];
|
|
|
|
id = "byzmw-f6zhg";
|
|
|
|
label = "video-shared";
|
|
|
|
};
|
|
|
|
stud-cache = {
|
|
|
|
devices = ["fwminex" "vno1-oh2"];
|
|
|
|
id = "2kq7n-jqzxj";
|
|
|
|
label = "stud-cache";
|
|
|
|
};
|
|
|
|
M-R = {
|
|
|
|
devices = ["fwminex" "rzj-744P2PE" "mxp10" "vno1-oh2"];
|
|
|
|
id = "evgn9-ahngz";
|
|
|
|
label = "M-R";
|
|
|
|
};
|
|
|
|
Irenos = {
|
2023-09-18 12:47:51 +03:00
|
|
|
devices = ["KrekenavosNamai" "vno1-oh2" "vno2-irena"];
|
2023-09-18 12:44:09 +03:00
|
|
|
id = "wuwai-qkcqj";
|
|
|
|
label = "Irenos";
|
|
|
|
};
|
|
|
|
www-fwminex = {
|
|
|
|
devices = ["fwminex" "vno1-oh2"];
|
|
|
|
id = "7z9sw-2nubh";
|
|
|
|
label = "www-fwminex";
|
|
|
|
};
|
|
|
|
www-mxp10 = {
|
|
|
|
devices = ["mxp10" "vno1-oh2"];
|
|
|
|
id = "gqrtz-prx9h";
|
|
|
|
label = "www-mxp10";
|
|
|
|
};
|
|
|
|
mykolo = {
|
|
|
|
devices = ["mxp10"];
|
|
|
|
id = "wslmq-fyw4w";
|
|
|
|
label = "mykolo";
|
|
|
|
};
|
2023-09-18 12:13:09 +03:00
|
|
|
};
|
2023-07-26 11:36:54 +03:00
|
|
|
in {
|
|
|
|
options.mj.services.syncthing = with lib.types; {
|
|
|
|
enable = lib.mkEnableOption "Enable services syncthing settings";
|
|
|
|
user = lib.mkOption {type = str;};
|
|
|
|
group = lib.mkOption {type = str;};
|
|
|
|
dataDir = lib.mkOption {type = path;};
|
|
|
|
};
|
|
|
|
|
2023-10-01 23:14:05 +03:00
|
|
|
config = lib.mkIf cfg.enable {
|
2023-09-12 15:46:44 +03:00
|
|
|
mj.services.friendlyport.ports = [
|
|
|
|
{
|
2023-09-12 16:08:08 +03:00
|
|
|
subnets = myData.subnets.motiejus.cidrs;
|
2023-09-12 15:46:44 +03:00
|
|
|
tcp = [8384];
|
|
|
|
}
|
|
|
|
];
|
2023-07-26 11:36:54 +03:00
|
|
|
|
2023-08-05 18:00:43 +03:00
|
|
|
services.syncthing = {
|
2023-10-01 23:26:01 +03:00
|
|
|
inherit (cfg) enable user group dataDir;
|
2023-10-01 23:14:05 +03:00
|
|
|
|
2023-08-05 18:00:43 +03:00
|
|
|
openDefaultPorts = true;
|
|
|
|
guiAddress = let
|
|
|
|
fqdn = with config.networking; "${hostName}.${domain}";
|
|
|
|
jakstIP = lib.getAttrFromPath [fqdn "jakstIP"] myData.hosts;
|
|
|
|
guiPortStr = builtins.toString guiPort;
|
|
|
|
in "${jakstIP}:${guiPortStr}";
|
2023-07-26 11:36:54 +03:00
|
|
|
|
2023-08-05 18:00:43 +03:00
|
|
|
extraOptions.gui.insecureAdminAccess = true;
|
2023-07-26 11:36:54 +03:00
|
|
|
|
2023-08-05 18:00:43 +03:00
|
|
|
devices =
|
|
|
|
{}
|
|
|
|
// (lib.optionalAttrs (config.networking.hostName == "vno1-oh2") {
|
2023-09-18 12:46:46 +03:00
|
|
|
inherit
|
|
|
|
(devices)
|
|
|
|
fwminex
|
|
|
|
vno1-oh2
|
|
|
|
mxp10
|
|
|
|
rzj-744P2PE
|
|
|
|
KrekenavosNamai
|
|
|
|
vno1-vinc
|
2023-09-18 12:48:22 +03:00
|
|
|
vno2-irena
|
2023-09-18 12:46:46 +03:00
|
|
|
;
|
2023-08-05 18:00:43 +03:00
|
|
|
})
|
2023-09-18 11:55:09 +03:00
|
|
|
// (lib.optionalAttrs (config.networking.hostName == "fwminex") {
|
2023-09-18 12:46:46 +03:00
|
|
|
inherit
|
|
|
|
(devices)
|
|
|
|
fwminex
|
|
|
|
vno1-oh2
|
|
|
|
mxp10
|
|
|
|
rzj-744P2PE
|
|
|
|
;
|
2023-09-18 11:55:09 +03:00
|
|
|
})
|
2023-08-05 18:00:43 +03:00
|
|
|
// {};
|
2023-07-26 11:36:54 +03:00
|
|
|
|
2023-09-18 12:38:17 +03:00
|
|
|
folders = with folders;
|
2023-09-18 11:55:09 +03:00
|
|
|
{}
|
|
|
|
// (
|
|
|
|
lib.optionalAttrs (config.networking.hostName == "vno1-oh2") {
|
2023-09-18 12:44:09 +03:00
|
|
|
"/var/www/dl/tel" = www-mxp10;
|
|
|
|
"/var/www/dl/fwminex" = www-fwminex;
|
|
|
|
"/var/www/dl/mykolo" = mykolo;
|
2023-09-18 12:38:17 +03:00
|
|
|
"${cfg.dataDir}/annex2/Books" = Books;
|
|
|
|
"${cfg.dataDir}/annex2/M-Active" = M-Active;
|
|
|
|
"${cfg.dataDir}/annex2/M-Camera" = M-Camera;
|
|
|
|
"${cfg.dataDir}/annex2/M-Documents" = M-Documents;
|
|
|
|
"${cfg.dataDir}/annex2/R-Documents" = R-Documents;
|
|
|
|
"${cfg.dataDir}/annex2/Pictures" = Pictures;
|
2023-09-18 12:44:09 +03:00
|
|
|
"${cfg.dataDir}/annex2/M-R" = M-R;
|
|
|
|
"${cfg.dataDir}/stud-cache" = stud-cache;
|
|
|
|
"${cfg.dataDir}/video/shared" = video-shared;
|
|
|
|
"${cfg.dataDir}/music" = Music;
|
|
|
|
"${cfg.dataDir}/irenos" = Irenos;
|
2023-09-18 11:55:09 +03:00
|
|
|
}
|
|
|
|
)
|
|
|
|
// (
|
|
|
|
lib.optionalAttrs (config.networking.hostName == "fwminex") {
|
2023-09-18 12:38:17 +03:00
|
|
|
"${cfg.dataDir}/Books" = Books;
|
|
|
|
"${cfg.dataDir}/M-Active" = M-Active;
|
|
|
|
"${cfg.dataDir}/M-Documents" = M-Documents;
|
|
|
|
"${cfg.dataDir}/M-Camera" = M-Camera;
|
|
|
|
"${cfg.dataDir}/Pictures" = Pictures;
|
2023-09-18 12:44:09 +03:00
|
|
|
"${cfg.dataDir}/Music" = Music;
|
|
|
|
"${cfg.dataDir}/M-R" = M-R;
|
|
|
|
"${cfg.dataDir}/Video" = video-shared;
|
|
|
|
"${cfg.dataDir}/stud-cache" = stud-cache;
|
|
|
|
"${cfg.dataDir}/www" = www-fwminex;
|
2023-09-18 11:55:09 +03:00
|
|
|
}
|
|
|
|
);
|
2023-07-26 11:36:54 +03:00
|
|
|
};
|
2023-08-05 18:00:43 +03:00
|
|
|
};
|
2023-07-26 11:36:54 +03:00
|
|
|
}
|