summary refs log tree commit diff
path: root/nixos/modules/services/networking/nat.nix
diff options
context:
space:
mode:
authorZhaofeng Li <hello@zhaofeng.li>2022-07-12 17:59:44 -0700
committerZhaofeng Li <hello@zhaofeng.li>2022-08-31 13:14:07 -0600
commit7689468a4ba2bfbaeaaf30c29bd19c9607a1dd99 (patch)
treedbff53433df9bbd9c49d8eb1573aecb224f0e1c0 /nixos/modules/services/networking/nat.nix
parent26c66bc7c8cec6008427d10a2e97b2862f4a3475 (diff)
downloadnixpkgs-7689468a4ba2bfbaeaaf30c29bd19c9607a1dd99.tar
nixpkgs-7689468a4ba2bfbaeaaf30c29bd19c9607a1dd99.tar.gz
nixpkgs-7689468a4ba2bfbaeaaf30c29bd19c9607a1dd99.tar.bz2
nixpkgs-7689468a4ba2bfbaeaaf30c29bd19c9607a1dd99.tar.lz
nixpkgs-7689468a4ba2bfbaeaaf30c29bd19c9607a1dd99.tar.xz
nixpkgs-7689468a4ba2bfbaeaaf30c29bd19c9607a1dd99.tar.zst
nixpkgs-7689468a4ba2bfbaeaaf30c29bd19c9607a1dd99.zip
nixos/nat: Use the package specified in networking.firewall.package
Otherwise the system path is inconsistent if you do something like

    networking.firewall.package = pkgs.iptables-legacy;
Diffstat (limited to 'nixos/modules/services/networking/nat.nix')
-rw-r--r--nixos/modules/services/networking/nat.nix7
1 files changed, 5 insertions, 2 deletions
diff --git a/nixos/modules/services/networking/nat.nix b/nixos/modules/services/networking/nat.nix
index 2e58cd699b2..c33c3db186e 100644
--- a/nixos/modules/services/networking/nat.nix
+++ b/nixos/modules/services/networking/nat.nix
@@ -319,7 +319,10 @@ in
         }
       ];
 
-      environment.systemPackages = [ pkgs.iptables ];
+      # Use the same iptables package as in config.networking.firewall.
+      # When the firewall is enabled, this should be deduplicated without any
+      # error.
+      environment.systemPackages = [ config.networking.firewall.package ];
 
       boot = {
         kernelModules = [ "nf_nat_ftp" ];
@@ -347,7 +350,7 @@ in
         description = "Network Address Translation";
         wantedBy = [ "network.target" ];
         after = [ "network-pre.target" "systemd-modules-load.service" ];
-        path = [ pkgs.iptables ];
+        path = [ config.networking.firewall.package ];
         unitConfig.ConditionCapability = "CAP_NET_ADMIN";
 
         serviceConfig = {