ipv6 stack enabled

This commit is contained in:
Steffen
2026-01-18 17:12:40 +01:00
parent 652d80bcc3
commit 0aeae6ffcd
+29 -29
View File
@@ -1,7 +1,3 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
@@ -31,11 +27,18 @@
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
# Enable IP forwarding for NAT (used in wireguard.nix) and load specific modules. # --- KERNEL NETWORK CONFIGURATION ---
# CRITICAL FOR DOCKER + IPV6
# 1. Enable Forwarding (Required for Docker)
# 2. Force Accept RA = 2 (Required to get IPv6 address even if forwarding is on)
boot.kernel.sysctl = { boot.kernel.sysctl = {
"net.ipv4.ip_forward" = 1; "net.ipv4.ip_forward" = 1;
"net.ipv6.conf.all.forwarding" = 1; "net.ipv6.conf.all.forwarding" = 1;
"net.ipv6.conf.all.accept_ra" = 2;
"net.ipv6.conf.default.accept_ra" = 2;
"net.ipv6.conf.${lib.head config.vars.interfaces}.accept_ra" = 2;
}; };
boot.kernelModules = [ "rbd" "nbd" ]; boot.kernelModules = [ "rbd" "nbd" ];
hardware.bluetooth.enable = true; hardware.bluetooth.enable = true;
@@ -45,39 +48,42 @@
}; };
}; };
networking.hostName = config.vars.hostname;
networking.hostId = config.vars.hostid;
networking = { networking = {
hostName = config.vars.hostname;
hostId = config.vars.hostid;
# Enable IPv6 Stack
enableIPv6 = true;
interfaces = let interfaces = let
primaryInterface = lib.head config.vars.interfaces; primaryInterface = lib.head config.vars.interfaces;
secondaryInterfaces = lib.tail config.vars.interfaces; secondaryInterfaces = lib.tail config.vars.interfaces;
in in
lib.foldr (name: acc: acc // { lib.foldr (name: acc: acc // {
# Secondary interfaces can keep using DHCP
${name}.useDHCP = true; ${name}.useDHCP = true;
}) ( }) (
{ ${primaryInterface}.ipv4.addresses = [{ { ${primaryInterface} = {
# PRIMARY INTERFACE: STATIC IPV4 ONLY
ipv4.addresses = [{
address = config.vars.local_ip; address = config.vars.local_ip;
prefixLength = 24; prefixLength = 24;
}]; }];
};
} }
) secondaryInterfaces; ) secondaryInterfaces;
};
networking.defaultGateway = { defaultGateway = {
address = "192.168.178.1"; address = "192.168.178.1";
interface = lib.head config.vars.interfaces; # Sticking with the primary interface interface = lib.head config.vars.interfaces;
};
nameservers = [ "192.168.178.10" "9.9.9.9" ];
}; };
networking.nameservers = [ "192.168.178.10" "9.9.9.9" ];
# Set your time zone. # Set your time zone.
time.timeZone = "Europe/Berlin"; time.timeZone = "Europe/Berlin";
# services.localtimed.enable = true;
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable the X11 windowing system. # Enable the X11 windowing system.
services.xserver.enable = false; services.xserver.enable = false;
@@ -98,8 +104,7 @@
# Allow unfree software and packages # Allow unfree software and packages
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run: # List packages installed in system profile.
# $ nix search wget
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
wget wget
htop htop
@@ -111,19 +116,14 @@
fzf fzf
]; ];
# Open ports in the firewall. # Firewall settings
# networking.firewall.allowedTCPPorts = [ ... ]; # Your firewall is DISABLED, so we don't need to manually add allowedUDPPorts for DHCPv6.
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
networking.firewall.enable = false; networking.firewall.enable = false;
# Copy the NixOS configuration file and link it from the resulting system # Copy the NixOS configuration file
# (/run/current-system/configuration.nix). This is useful in case you
# accidentally delete configuration.nix.
system.copySystemConfiguration = true; system.copySystemConfiguration = true;
# DO NOT TOUCH!!!!!!!!!!!!!!!!!!!!!!!!!! # DO NOT TOUCH!!!!!!!!!!!!!!!!!!!!!!!!!!
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . system.stateVersion = config.vars.stateVersion;
system.stateVersion = config.vars.stateVersion; # Set via host-specific vars.nix
# DO NOT TOUCH!!!!!!!!!!!!!!!!!!!!!!!!!! # DO NOT TOUCH!!!!!!!!!!!!!!!!!!!!!!!!!!
} }