From 178107af0ce6df62d36004cdcb3f3a8414f6a6a5 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Mon, 9 May 2022 00:20:02 +0200 Subject: Network configuration updates --- nix/deuxfleurs.nix | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) (limited to 'nix/deuxfleurs.nix') diff --git a/nix/deuxfleurs.nix b/nix/deuxfleurs.nix index 09ba526..ae472ab 100644 --- a/nix/deuxfleurs.nix +++ b/nix/deuxfleurs.nix @@ -6,7 +6,7 @@ in with builtins; with pkgs.lib; { - options.deuxfleurs = + options.deuxfleurs = { # Parameters for individual nodes network_interface = mkOption { @@ -81,21 +81,26 @@ in }) cfg.admin_accounts; # Configure network interfaces - networking.interfaces = attrsets.setAttrByPath [ cfg.network_interface ] { - useDHCP = false; - ipv4.addresses = [ - { - address = cfg.lan_ip; - prefixLength = cfg.lan_ip_prefix_length; - } - ]; - ipv6.addresses = [ - { - address = cfg.ipv6; - prefixLength = cfg.ipv6_prefix_length; - } - ]; - }; + networking.interfaces = + let ip4config = { + useDHCP = false; + ipv4.addresses = [ + { + address = cfg.lan_ip; + prefixLength = cfg.lan_ip_prefix_length; + } + ]; + }; + ip6config = { + ipv6.addresses = [ + { + address = cfg.ipv6; + prefixLength = cfg.ipv6_prefix_length; + } + ]; + }; + in + (attrsets.setAttrByPath [ cfg.network_interface ] (ip4config // ip6config)); networking.defaultGateway = { address = cfg.lan_default_gateway; interface = cfg.network_interface; -- cgit v1.2.3