From 05bf499beaab80fcfa69c2af0eaf16c952e8b8cc Mon Sep 17 00:00:00 2001 From: Fuwn Date: Mon, 23 Sep 2024 04:18:52 -0700 Subject: modules: move shared modules to core --- modules/core/default.nix | 2 +- modules/core/networking/default.nix | 22 ++++++++++++++++++++++ modules/core/networking/tailscale.nix | 35 +++++++++++++++++++++++++++++++++++ modules/core/tailscale.nix | 35 ----------------------------------- 4 files changed, 58 insertions(+), 36 deletions(-) create mode 100644 modules/core/networking/default.nix create mode 100644 modules/core/networking/tailscale.nix delete mode 100644 modules/core/tailscale.nix (limited to 'modules/core') diff --git a/modules/core/default.nix b/modules/core/default.nix index b086a28..a798030 100644 --- a/modules/core/default.nix +++ b/modules/core/default.nix @@ -1,8 +1,8 @@ { imports = [ + ./networking ./nix ./sops.nix - ./tailscale.nix ]; programs.mosh = { diff --git a/modules/core/networking/default.nix b/modules/core/networking/default.nix new file mode 100644 index 0000000..5e53759 --- /dev/null +++ b/modules/core/networking/default.nix @@ -0,0 +1,22 @@ +{ secrets, ... }: +{ + imports = [ ./tailscale.nix ]; + + networking = { + nftables.enable = true; + + nameservers = [ + "45.90.28.0#${secrets.nextdns_id}.dns.nextdns.io" + "2a07:a8c0::#${secrets.nextdns_id}.dns.nextdns.io" + "45.90.30.0#${secrets.nextdns_id}.dns.nextdns.io" + "2a07:a8c1::#${secrets.nextdns_id}.dns.nextdns.io" + ]; + + timeServers = [ + "0.nixos.pool.ntp.org" + "1.nixos.pool.ntp.org" + "2.nixos.pool.ntp.org" + "3.nixos.pool.ntp.org" + ]; + }; +} diff --git a/modules/core/networking/tailscale.nix b/modules/core/networking/tailscale.nix new file mode 100644 index 0000000..0228915 --- /dev/null +++ b/modules/core/networking/tailscale.nix @@ -0,0 +1,35 @@ +{ + config, + lib, + pkgs, + ... +}: +{ + networking.firewall.trustedInterfaces = [ "${config.services.tailscale.interfaceName}" ]; + + # + boot.kernel.sysctl = { + "net.ipv4.ip_forward" = true; + "net.ipv6.conf.all.forwarding" = true; + }; + + services = { + tailscale = { + enable = true; + useRoutingFeatures = "both"; + authKeyFile = config.sops.secrets.tailscale_authentication_key.path; + }; + + networkd-dispatcher = { + enable = true; + + rules."50-tailscale" = { + onState = [ "routable" ]; + + script = '' + ${lib.getExe pkgs.ethtool} -K enp42s0 rx-udp-gro-forwarding on rx-gro-list off + ''; + }; + }; + }; +} diff --git a/modules/core/tailscale.nix b/modules/core/tailscale.nix deleted file mode 100644 index 0228915..0000000 --- a/modules/core/tailscale.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -{ - networking.firewall.trustedInterfaces = [ "${config.services.tailscale.interfaceName}" ]; - - # - boot.kernel.sysctl = { - "net.ipv4.ip_forward" = true; - "net.ipv6.conf.all.forwarding" = true; - }; - - services = { - tailscale = { - enable = true; - useRoutingFeatures = "both"; - authKeyFile = config.sops.secrets.tailscale_authentication_key.path; - }; - - networkd-dispatcher = { - enable = true; - - rules."50-tailscale" = { - onState = [ "routable" ]; - - script = '' - ${lib.getExe pkgs.ethtool} -K enp42s0 rx-udp-gro-forwarding on rx-gro-list off - ''; - }; - }; - }; -} -- cgit v1.2.3