summaryrefslogtreecommitdiff
path: root/config/networking/services/igmpproxy.nix
diff options
context:
space:
mode:
Diffstat (limited to 'config/networking/services/igmpproxy.nix')
-rw-r--r--config/networking/services/igmpproxy.nix31
1 files changed, 18 insertions, 13 deletions
diff --git a/config/networking/services/igmpproxy.nix b/config/networking/services/igmpproxy.nix
index 6999807..d3ac7f3 100644
--- a/config/networking/services/igmpproxy.nix
+++ b/config/networking/services/igmpproxy.nix
@@ -1,20 +1,25 @@
-{ config, pkgs, ... }:
-
-let
- nets = config.personal.networking.networks;
- netdevServices = builtins.map (subnet: "${subnet.interface}-netdev.service")
- (with nets; [ wan iot ]);
- conf = pkgs.writeText "igmpproxy.conf" ''
- phyint ${nets.wan.interface} upstream ratelimit 0 threshold 1
- phyint ${nets.iot.interface} downstream ratelimit 0 threshold 1
- '';
+{
+ lib,
+ pkgs,
+ ...
+}: let
+ upstream = "wan";
+ downstream = ["iot"];
+ netdevServices = builtins.map (iface: "${iface}-netdev.service") ([upstream] ++ downstream);
+ conf = pkgs.writeText "igmpproxy.conf" (''
+ phyint ${upstream} upstream ratelimit 0 threshold 1
+ ''
+ + lib.concatMapStrings (iface: ''
+ phyint ${iface} downstream ratelimit 0 threshold 1
+ '')
+ downstream);
in {
systemd.services.igmpproxy = {
description = "Multicast router utilizing IGMP forwarding";
- wantedBy = [ "multi-user.target" ];
- after = [ "kea-dhcp4-server.service" ] ++ netdevServices;
+ wantedBy = ["multi-user.target"];
+ after = ["kea-dhcp4-server.service"] ++ netdevServices;
bindsTo = netdevServices;
- path = [ pkgs.igmpproxy ];
+ path = [pkgs.igmpproxy];
script = "igmpproxy -v -n ${conf}";
};
}