62 lines
1.2 KiB
Nix
62 lines
1.2 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
...
|
|
}:
|
|
let
|
|
syncMachines = lib.listToAttrs (
|
|
lib.concatMap (
|
|
machine:
|
|
lib.optional (machine.syncthingId != null) (
|
|
let
|
|
name = "${config.repo.account.name}@${machine.name}";
|
|
in
|
|
{
|
|
inherit name;
|
|
value = {
|
|
inherit name;
|
|
id = machine.syncthingId;
|
|
};
|
|
}
|
|
)
|
|
) (builtins.attrValues config.repo.machines)
|
|
);
|
|
|
|
syncPhones = {
|
|
"pixel-10" = {
|
|
name = "pixel-10";
|
|
id = "MTJHEHA-UMZDQZ7-BTMRRLQ-Y7BFPUJ-ZTY6LZX-PDXV3IS-XVJCU7B-EPETBQZ";
|
|
};
|
|
};
|
|
|
|
syncDevices = syncMachines // syncPhones;
|
|
in
|
|
{
|
|
flake.modules.homeManager.syncthing =
|
|
{ ... }:
|
|
{
|
|
services.syncthing = {
|
|
enable = true;
|
|
|
|
overrideDevices = true;
|
|
overrideFolders = true;
|
|
|
|
settings = {
|
|
folders = {
|
|
sync = {
|
|
path = "~/sync";
|
|
label = "sync";
|
|
devices = builtins.attrNames syncDevices;
|
|
};
|
|
calibre = {
|
|
path = "~/calibre";
|
|
label = "calibre";
|
|
devices = builtins.attrNames syncMachines;
|
|
};
|
|
};
|
|
devices = syncDevices;
|
|
};
|
|
};
|
|
};
|
|
}
|