2025-11-30 14:32:36 -05:00
{
config ,
lib ,
pkgs ,
. . .
} :
# Alternative DNS servers:
# "1.0.0.1#cloudflare-dns.com"
# "1.1.1.1#cloudflare-dns.com"
# "2606:4700:4700::1001#cloudflare-dns.com"
# "2606:4700:4700::1111#cloudflare-dns.com"
# "8.8.4.4#dns.google"
# "8.8.8.8#dns.google"
# "2001:4860:4860::8844#dns.google"
# "2001:4860:4860::8888#dns.google"
{
imports = [ ] ;
options . me = {
network . enable = lib . mkOption {
type = lib . types . bool ;
default = false ;
example = true ;
description = " W h e t h e r w e w a n t t o i n s t a l l n e t w o r k . " ;
} ;
} ;
config = lib . mkIf config . me . network . enable {
networking . dhcpcd . enable = lib . mkDefault false ;
networking . useDHCP = lib . mkDefault false ;
2025-12-29 19:11:55 -05:00
# Nameservers configured in host-specific files.
# networking.nameservers = [
# "194.242.2.2#doh.mullvad.net"
# "2a07:e340::2#doh.mullvad.net"
# ];
2025-11-30 14:32:36 -05:00
networking . nameservers = [
2025-12-29 19:11:55 -05:00
" 1 0 . 2 1 5 . 1 . 1 "
" 2 6 2 0 : 1 1 f : 7 0 0 1 : 7 : f f f f : f f f f : 0 a d 7 : 0 1 0 1 "
2025-11-30 14:32:36 -05:00
] ;
services . resolved = {
enable = true ;
# dnssec = "true";
domains = [ " ~ . " ] ;
fallbackDns = [ ] ;
2025-12-29 19:11:55 -05:00
# dnsovertls = "true";
2025-11-30 14:32:36 -05:00
} ;
# Without this, systemd-resolved will send DNS requests for <X>.home.arpa to the per-link DNS server (172.16.0.1) which does not support DNS-over-TLS. This leads to the connection hanging and timing out. This causes firefox startup to take an extra 10+ seconds.
#
# Test with: drill @127.0.0.53 odo.home.arpa
# TODO: The 127.0.0.1 address should probably be moved to a host-specific file.
networking . extraHosts = ''
127 .0 .0 .1 $ { config . networking . hostName } . home . arpa
2025-12-18 22:28:03 -05:00
2620 : 1 1 f:7001:7:ffff:ffff:0ad7:01dd controller0 . kubernetes . local controller0
2620 : 1 1 f:7001:7:ffff:ffff:0ad7:01de controller1 . kubernetes . local controller1
2620 : 1 1 f:7001:7:ffff:ffff:0ad7:01df controller2 . kubernetes . local controller2
2620 : 1 1 f:7001:7:ffff:ffff:0ad7:01e0 worker0 . kubernetes . local worker0
2620 : 1 1 f:7001:7:ffff:ffff:0ad7:01e1 worker1 . kubernetes . local worker1
2620 : 1 1 f:7001:7:ffff:ffff:0ad7:01e2 worker2 . kubernetes . local worker2
2025-11-30 14:32:36 -05:00
'' ;
boot . extraModprobeConfig = ''
# Set wifi to US
options cfg80211 ieee80211_regdom = US
'' ;
boot . kernel . sysctl = {
# Enable TCP packetization-layer PMTUD when an ICMP black hole is detected.
" n e t . i p v 4 . t c p _ m t u _ p r o b i n g " = 1 ;
# Switch to bbr tcp congestion control which should be better on lossy connections like bad wifi.
# We set this in the kernel config, but include this here for unoptimized builds.
" n e t . i p v 4 . t c p _ c o n g e s t i o n _ c o n t r o l " = " b b r " ;
# Don't do a slow start after a connection has been idle for a single RTO.
" n e t . i p v 4 . t c p _ s l o w _ s t a r t _ a f t e r _ i d l e " = 0 ;
# 3x time to accumulate filesystem changes before flushing to disk.
" v m . d i r t y _ w r i t e b a c k _ c e n t i s e c s " = 1500 ;
# Adjust ttl
" n e t . i p v 4 . i p _ d e f a u l t _ t t l " = 65 ;
" n e t . i p v 6 . c o n f . a l l . h o p _ l i m i t " = 65 ;
" n e t . i p v 6 . c o n f . d e f a u l t . h o p _ l i m i t " = 65 ;
# Enable IPv6 Privacy Extensions
" n e t . i p v 6 . c o n f . a l l . u s e _ t e m p a d d r " = 2 ;
# Enable IPv6 Privacy Extensions
# This is enabled by default in nixos.
# "net.ipv6.conf.default.use_tempaddr" = 2;
} ;
} ;
}