refactor: restructure config files
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
syncthingMesh = 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)
|
||||
);
|
||||
in
|
||||
{
|
||||
flake.modules.homeManager.syncthing =
|
||||
{ ... }:
|
||||
{
|
||||
services.syncthing = {
|
||||
enable = true;
|
||||
|
||||
overrideDevices = true;
|
||||
overrideFolders = true;
|
||||
|
||||
settings = {
|
||||
folders = {
|
||||
sync = {
|
||||
path = "~/sync";
|
||||
label = "sync";
|
||||
devices = builtins.attrNames syncthingMesh;
|
||||
};
|
||||
calibre = {
|
||||
path = "~/calibre";
|
||||
label = "calibre";
|
||||
devices = builtins.attrNames syncthingMesh;
|
||||
};
|
||||
};
|
||||
devices = syncthingMesh;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user