l syncthing: just configure used peers
This commit is contained in:
parent
cefb50f5f1
commit
8e5eb283f4
|
@ -1,6 +1,9 @@
|
||||||
{ config, pkgs, ... }: with import <stockholm/lib>; let
|
{ config, pkgs, ... }: with import <stockholm/lib>; let
|
||||||
all_peers = filterAttrs (n: v: v.syncthing.id != null) config.krebs.hosts;
|
|
||||||
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;
|
||||||
|
used_peer_names = unique (flatten (mapAttrsToList (n: v: v.devices) config.services.syncthing.declarative.folders));
|
||||||
|
used_peers = filterAttrs (n: v: elem n used_peer_names) all_peers;
|
||||||
in {
|
in {
|
||||||
services.syncthing = {
|
services.syncthing = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -9,7 +12,7 @@ in {
|
||||||
declarative = {
|
declarative = {
|
||||||
key = toString <secrets/syncthing.key>;
|
key = toString <secrets/syncthing.key>;
|
||||||
cert = toString <secrets/syncthing.cert>;
|
cert = toString <secrets/syncthing.cert>;
|
||||||
devices = mk_peers all_peers;
|
devices = mk_peers used_peers;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
krebs.iptables.tables.filter.INPUT.rules = [
|
krebs.iptables.tables.filter.INPUT.rules = [
|
||||||
|
|
Loading…
Reference in New Issue
Block a user