diff options
Diffstat (limited to 'nix')
-rw-r--r-- | nix/deuxfleurs.nix | 37 |
1 files changed, 21 insertions, 16 deletions
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; |