Commit
This commit is contained in:
49
modules/apps/syncthing.nix
Normal file
49
modules/apps/syncthing.nix
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
inputs,
|
||||
den,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
meshDevices = lib.listToAttrs (
|
||||
lib.concatMap (
|
||||
host:
|
||||
lib.mapAttrsToList (
|
||||
userName: user:
|
||||
let
|
||||
name = "${userName}@${host.name}";
|
||||
in
|
||||
{
|
||||
inherit name;
|
||||
value = {
|
||||
inherit name;
|
||||
id = user.syncthingId;
|
||||
};
|
||||
}
|
||||
) (lib.filterAttrs (_: u: u ? syncthingId) host.users)
|
||||
) (lib.attrValues den.hosts.x86_64-linux)
|
||||
);
|
||||
in
|
||||
{
|
||||
lux.syncthing = {
|
||||
homeManager = {
|
||||
services.syncthing = {
|
||||
enable = true;
|
||||
|
||||
overrideDevices = true;
|
||||
overrideFolders = true;
|
||||
|
||||
settings = {
|
||||
folders = {
|
||||
sync = {
|
||||
path = "~/sync";
|
||||
label = "sync";
|
||||
devices = lib.attrNames meshDevices;
|
||||
};
|
||||
};
|
||||
devices = meshDevices;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user