summaryrefslogtreecommitdiffstats
path: root/nixos/modules/tasks/network-interfaces.nix
diff options
context:
space:
mode:
authorParnell Springmeyer <parnell@digitalmentat.com>2017-02-13 17:16:28 -0600
committerParnell Springmeyer <parnell@digitalmentat.com>2017-02-13 17:16:28 -0600
commit9e36a58649199a16a15cba3c78966ab0538a6fd7 (patch)
tree289d50ecf1068cfac80bdeabdd34d2d42ecbd755 /nixos/modules/tasks/network-interfaces.nix
parent128bdac94fe8173845e162c61ddb83cb4b8ed8de (diff)
parent486b9be579fc1f046671ddaf1157f084ba956bdd (diff)
Merging against upstream master
Diffstat (limited to 'nixos/modules/tasks/network-interfaces.nix')
-rw-r--r--nixos/modules/tasks/network-interfaces.nix49
1 files changed, 43 insertions, 6 deletions
diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix
index dc77a6a40f83..28c7b358093d 100644
--- a/nixos/modules/tasks/network-interfaces.nix
+++ b/nixos/modules/tasks/network-interfaces.nix
@@ -116,6 +116,35 @@ let
};
};
+ gatewayCoerce = address: { inherit address; };
+
+ gatewayOpts = { ... }: {
+
+ options = {
+
+ address = mkOption {
+ type = types.str;
+ description = "The default gateway address.";
+ };
+
+ interface = mkOption {
+ type = types.nullOr types.str;
+ default = null;
+ example = "enp0s3";
+ description = "The default gateway interface.";
+ };
+
+ metric = mkOption {
+ type = types.nullOr types.int;
+ default = null;
+ example = 42;
+ description = "The default gateway metric/preference.";
+ };
+
+ };
+
+ };
+
interfaceOpts = { name, ... }: {
options = {
@@ -327,19 +356,27 @@ in
networking.defaultGateway = mkOption {
default = null;
- example = "131.211.84.1";
- type = types.nullOr types.str;
+ example = {
+ address = "131.211.84.1";
+ device = "enp3s0";
+ };
+ type = types.nullOr (types.coercedTo types.str gatewayCoerce (types.submodule gatewayOpts));
description = ''
- The default gateway. It can be left empty if it is auto-detected through DHCP.
+ The default gateway. It can be left empty if it is auto-detected through DHCP.
+ It can be specified as a string or an option set along with a network interface.
'';
};
networking.defaultGateway6 = mkOption {
default = null;
- example = "2001:4d0:1e04:895::1";
- type = types.nullOr types.str;
+ example = {
+ address = "2001:4d0:1e04:895::1";
+ device = "enp3s0";
+ };
+ type = types.nullOr (types.coercedTo types.str gatewayCoerce (types.submodule gatewayOpts));
description = ''
- The default ipv6 gateway. It can be left empty if it is auto-detected through DHCP.
+ The default ipv6 gateway. It can be left empty if it is auto-detected through DHCP.
+ It can be specified as a string or an option set along with a network interface.
'';
};