aboutsummaryrefslogtreecommitdiff
path: root/nix/deuxfleurs.nix
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-05-09 00:20:02 +0200
committerAlex Auvolat <alex@adnab.me>2022-05-09 00:20:02 +0200
commit178107af0ce6df62d36004cdcb3f3a8414f6a6a5 (patch)
tree9ea91a3ce2813e49b22a87f3266d836055a1c572 /nix/deuxfleurs.nix
parent83dd3ea25ac7ded159105e2501b438dac4e01e22 (diff)
downloadnixcfg-178107af0ce6df62d36004cdcb3f3a8414f6a6a5.tar.gz
nixcfg-178107af0ce6df62d36004cdcb3f3a8414f6a6a5.zip
Network configuration updates
Diffstat (limited to 'nix/deuxfleurs.nix')
-rw-r--r--nix/deuxfleurs.nix37
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;