2023-07-16 17:55:50 +02:00
|
|
|
{
|
|
|
|
liminix
|
|
|
|
, lib
|
|
|
|
, firewallgen
|
|
|
|
, nftables
|
|
|
|
}:
|
2024-03-21 13:00:34 +01:00
|
|
|
{ rules, extraRules }:
|
2023-07-16 17:55:50 +02:00
|
|
|
let
|
|
|
|
inherit (liminix.services) oneshot;
|
|
|
|
inherit (liminix.lib) typeChecked;
|
|
|
|
inherit (lib) mkOption types;
|
2024-03-21 13:00:34 +01:00
|
|
|
script = firewallgen "firewall.nft" (lib.recursiveUpdate rules extraRules);
|
2023-07-16 17:55:50 +02:00
|
|
|
in oneshot {
|
|
|
|
name = "firewall";
|
|
|
|
up = script;
|
|
|
|
down = "${nftables}/bin/nft flush ruleset";
|
|
|
|
}
|