Compare commits
1 Commits
0156323836
...
db56045573
Author | SHA1 | Date | |
---|---|---|---|
|
db56045573 |
@ -1,17 +1,21 @@
|
|||||||
{ config, pkgs, ... }: with import <stockholm/lib>; let
|
{ options, config, pkgs, ... }: with import <stockholm/lib>; let
|
||||||
mk_peers = mapAttrs (n: v: { id = v.syncthing.id; });
|
mk_peers = mapAttrs (n: v: { id = v.syncthing.id; });
|
||||||
|
|
||||||
all_peers = filterAttrs (n: v: v.syncthing.id != null) config.krebs.hosts;
|
all_peers = filterAttrs (n: v: v.syncthing.id != null) config.krebs.hosts;
|
||||||
used_peer_names = unique (flatten (mapAttrsToList (n: v: v.devices) config.services.syncthing.declarative.folders));
|
used_peer_names = unique (flatten (mapAttrsToList (n: v: v.devices) (lib.filter isString config.services.syncthing.settings.folders)));
|
||||||
used_peers = filterAttrs (n: v: elem n used_peer_names) all_peers;
|
used_peers = filterAttrs (n: v: elem n used_peer_names) all_peers;
|
||||||
in {
|
in {
|
||||||
services.syncthing = {
|
services.syncthing = {
|
||||||
enable = true;
|
enable = true;
|
||||||
configDir = "/var/lib/syncthing";
|
configDir = "/var/lib/syncthing";
|
||||||
devices = mk_peers used_peers;
|
|
||||||
key = toString <secrets/syncthing.key>;
|
key = toString <secrets/syncthing.key>;
|
||||||
cert = toString <secrets/syncthing.cert>;
|
cert = toString <secrets/syncthing.cert>;
|
||||||
};
|
# workaround for infinite recursion on unstable, remove in 23.11
|
||||||
|
} // (if builtins.hasAttr "settings" options.services.syncthing then
|
||||||
|
{ settings.devices = mk_peers used_peers; }
|
||||||
|
else
|
||||||
|
{ devices = mk_peers used_peers; }
|
||||||
|
);
|
||||||
|
|
||||||
boot.kernel.sysctl."fs.inotify.max_user_watches" = 524288;
|
boot.kernel.sysctl."fs.inotify.max_user_watches" = 524288;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user