diff options
author | lassulus <git@lassul.us> | 2023-09-14 12:18:45 +0200 |
---|---|---|
committer | lassulus <git@lassul.us> | 2023-09-14 12:18:45 +0200 |
commit | 4820fc27cdc44a12b57d52c5fb7a932407d765a1 (patch) | |
tree | 3a31e612fe6141c1079a7fee37db1bb80486ac33 /tv/3modules/dnsmasq.nix | |
parent | d5305cdab1eadfe972ae0d1adc94192bb62ca6bc (diff) | |
parent | 1e03553fe6058d06c00a6c92e0ef486282057595 (diff) |
Merge remote-tracking branch 'ni/master'
Diffstat (limited to 'tv/3modules/dnsmasq.nix')
-rw-r--r-- | tv/3modules/dnsmasq.nix | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/tv/3modules/dnsmasq.nix b/tv/3modules/dnsmasq.nix deleted file mode 100644 index e1dfdea34..000000000 --- a/tv/3modules/dnsmasq.nix +++ /dev/null @@ -1,58 +0,0 @@ -with import ./lib; -{ config, ... }: let - cfg = config.tv.dnsmasq; -in { - - options.tv.dnsmasq = { - enable = mkEnableOption "tv.dnsmasq"; - dhcp-range = mkOption { - type = types.str; - }; - interface = mkOption { - type = types.str; - }; - address = mkOption { - type = types.str; - }; - prefixLength = mkOption { - type = types.addCheck types.int (x: x >= 0 && x <= 32); - }; - }; - - config = mkIf cfg.enable (mkMerge [ - { - networking.dhcpcd.denyInterfaces = [ cfg.interface ]; - services.dnsmasq.resolveLocalQueries = false; - networking.interfaces.${cfg.interface} = { - ipv4.addresses = singleton { - address = cfg.address; - prefixLength = cfg.prefixLength; - }; - }; - services.dnsmasq.enable = true; - services.dnsmasq.extraConfig = '' - bind-interfaces - dhcp-range=${cfg.dhcp-range} - listen-address=${cfg.address} - ''; - tv.iptables.extra.filter.INPUT = [ - "-i ${cfg.interface} -p tcp -m tcp --dport bootps -j ACCEPT" - "-i ${cfg.interface} -p udp -m udp --dport bootps -j ACCEPT" - "-i ${cfg.interface} -p tcp -m tcp --dport domain -j ACCEPT" - "-i ${cfg.interface} -p udp -m udp --dport domain -j ACCEPT" - ]; - } - { - # enable forwarding - boot.kernel.sysctl."net.ipv4.ip_forward" = true; - tv.iptables.extra.filter.FORWARD = [ - "-m state --state RELATED,ESTABLISHED -j ACCEPT" - "-i ${cfg.interface} -j ACCEPT" - ]; - tv.iptables.extra.nat.POSTROUTING = [ - "-j MASQUERADE" - ]; - } - ]); - -} |