summary refs log tree commit diff
path: root/nixos/modules/services/networking/nat.nix
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-10-30 17:37:45 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-10-30 18:47:43 +0100
commit408b8b5725c3e6fff75aef772da248d3e95ff414 (patch)
tree692e3b61dbbff85cc97e3becf13a1376dea04a92 /nixos/modules/services/networking/nat.nix
parentd882e1966251880240599d3c1b31e060661506ee (diff)
downloadnixpkgs-408b8b5725c3e6fff75aef772da248d3e95ff414.tar
nixpkgs-408b8b5725c3e6fff75aef772da248d3e95ff414.tar.gz
nixpkgs-408b8b5725c3e6fff75aef772da248d3e95ff414.tar.bz2
nixpkgs-408b8b5725c3e6fff75aef772da248d3e95ff414.tar.lz
nixpkgs-408b8b5725c3e6fff75aef772da248d3e95ff414.tar.xz
nixpkgs-408b8b5725c3e6fff75aef772da248d3e95ff414.tar.zst
nixpkgs-408b8b5725c3e6fff75aef772da248d3e95ff414.zip
Add lots of missing option types
Diffstat (limited to 'nixos/modules/services/networking/nat.nix')
-rw-r--r--nixos/modules/services/networking/nat.nix11
1 files changed, 6 insertions, 5 deletions
diff --git a/nixos/modules/services/networking/nat.nix b/nixos/modules/services/networking/nat.nix
index 9d62a764f06..ce28f018828 100644
--- a/nixos/modules/services/networking/nat.nix
+++ b/nixos/modules/services/networking/nat.nix
@@ -19,6 +19,7 @@ in
   options = {
 
     networking.nat.enable = mkOption {
+      type = types.bool;
       default = false;
       description =
         ''
@@ -27,6 +28,7 @@ in
     };
 
     networking.nat.internalIPs = mkOption {
+      type = types.listOf types.str;
       example = [ "192.168.1.0/24" ] ;
       description =
         ''
@@ -34,12 +36,10 @@ in
           coming from these networks and destined for the external
           interface will be rewritten.
         '';
-      # Backward compatibility: this used to be a single range instead
-      # of a list.
-      apply = x: if isList x then x else [x];
     };
 
     networking.nat.externalInterface = mkOption {
+      type = types.str;
       example = "eth1";
       description =
         ''
@@ -48,7 +48,8 @@ in
     };
 
     networking.nat.externalIP = mkOption {
-      default = "";
+      type = types.nullOr types.str;
+      default = null;
       example = "203.0.113.123";
       description =
         ''
@@ -86,7 +87,7 @@ in
             ''
             iptables -t nat -A POSTROUTING \
               -s ${network} -o ${cfg.externalInterface} \
-              ${if cfg.externalIP == ""
+              ${if cfg.externalIP == null
                 then "-j MASQUERADE"
                 else "-j SNAT --to-source ${cfg.externalIP}"}
             ''