~jb55/citadel

ref: cb7000756f32cda930119608f0842cb11413cc29 citadel/nix-config/networking/desktop/default.nix -rw-r--r-- 586 bytes
cb700075William Casarin make notifications work on all desktops 1 year, 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
extra:
{ config, lib, pkgs, ... }:
let
  ports = {
    notify = extra.private.notify-port;
  };

  firewallRules = [
    "nixos-fw -s 10.100.0.1/24,45.79.91.128 -p udp --dport ${toString ports.notify} -j nixos-fw-accept"
  ];

  addRule = rule: "iptables -A ${rule}";
  rmRule = rule: "iptables -D ${rule} || true";
  extraCommands = lib.concatStringsSep "\n" (map addRule firewallRules);
  extraStopCommands = lib.concatStringsSep "\n" (map rmRule firewallRules);
in
{
  networking.firewall.extraCommands = extraCommands;
  networking.firewall.extraStopCommands = extraStopCommands;
}