forked from DGNum/liminix
1a314e55b7
a firewall with no configuration will get a relatively sane ruleset. a firewall with `extraRules` will get them deep merged into the default rules. Specifying `rules` will override the defaults
17 lines
355 B
Nix
17 lines
355 B
Nix
{
|
|
liminix
|
|
, lib
|
|
, firewallgen
|
|
, nftables
|
|
}:
|
|
{ rules, extraRules }:
|
|
let
|
|
inherit (liminix.services) oneshot;
|
|
inherit (liminix.lib) typeChecked;
|
|
inherit (lib) mkOption types;
|
|
script = firewallgen "firewall.nft" (lib.recursiveUpdate rules extraRules);
|
|
in oneshot {
|
|
name = "firewall";
|
|
up = script;
|
|
down = "${nftables}/bin/nft flush ruleset";
|
|
}
|