summaryrefslogtreecommitdiff
path: root/config/networking/services/igmpproxy.nix
blob: 6bfb43b444b21c70cae21acff14f02f7012165a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{ config, pkgs, ... }:

let
  nets = config.personal.networking.networks;
  nets-dependencies =
    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 phyint ${nets.lan.interface} downstream ratelimit 0 threshold 1
  '';
in {
  systemd.services.igmpproxy = {
    description = "Multicast router utilizing IGMP forwarding";
    wantedBy = [ "multi-user.target" ];
    after = [ "network.target" ] ++ nets-dependencies;
    requires = nets-dependencies;
    path = [ pkgs.igmpproxy ];
    script = "igmpproxy -v -n ${conf}";
  };
}