From f87ba26c5eaa8694b920dc44c14ecbc26ec7d58d Mon Sep 17 00:00:00 2001 From: halbg0tt Date: Mon, 6 Jul 2026 22:24:28 +0200 Subject: [PATCH] add voyager --- hosts/voyager/hardware-configuration.nix | 7 +++-- hosts/voyager/modules/boot.nix | 14 ++++----- hosts/voyager/modules/default.nix | 5 ++-- hosts/voyager/modules/dhcp.nix | 0 hosts/voyager/modules/dnsmasq.nix | 19 ++++++++++++ hosts/voyager/modules/firewall.nix | 0 hosts/voyager/modules/nat.nix | 0 hosts/voyager/modules/networking.nix | 38 ++++++++++++++++-------- hosts/voyager/modules/ssh.nix | 8 +++++ 9 files changed, 65 insertions(+), 26 deletions(-) delete mode 100644 hosts/voyager/modules/dhcp.nix create mode 100644 hosts/voyager/modules/dnsmasq.nix delete mode 100644 hosts/voyager/modules/firewall.nix delete mode 100644 hosts/voyager/modules/nat.nix create mode 100644 hosts/voyager/modules/ssh.nix diff --git a/hosts/voyager/hardware-configuration.nix b/hosts/voyager/hardware-configuration.nix index d4ca9f3..eb042e6 100644 --- a/hosts/voyager/hardware-configuration.nix +++ b/hosts/voyager/hardware-configuration.nix @@ -1,3 +1,4 @@ + { config, lib, pkgs, modulesPath, ... }: { @@ -5,18 +6,18 @@ [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" ]; + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; fileSystems."/" = - { device = "/dev/disk/by-uuid/dfbd029b-d568-41fc-93f3-43a6ac059661"; + { device = "/dev/disk/by-uuid/9fbbbd3d-29ed-4add-93d7-59cc47dfab35"; fsType = "ext4"; }; fileSystems."/boot" = - { device = "/dev/disk/by-uuid/1942-B7E9"; + { device = "/dev/disk/by-uuid/C126-64DE"; fsType = "vfat"; options = [ "fmask=0022" "dmask=0022" ]; }; diff --git a/hosts/voyager/modules/boot.nix b/hosts/voyager/modules/boot.nix index fae17e9..eb50b2d 100644 --- a/hosts/voyager/modules/boot.nix +++ b/hosts/voyager/modules/boot.nix @@ -2,12 +2,12 @@ _: { boot = { loader = { - systemd-boot = { - enable = true; - }; - efi = { - canTouchEfiVariables = true; - }; + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; }; - }; + kernel.sysctl = { + "net.ipv4.ip_forward" = 1; + "net.ipv6.conf.all.forwarding" = 1; + }; + }; } diff --git a/hosts/voyager/modules/default.nix b/hosts/voyager/modules/default.nix index 4f30806..d9115ba 100644 --- a/hosts/voyager/modules/default.nix +++ b/hosts/voyager/modules/default.nix @@ -1,13 +1,12 @@ { config, pkgs, ... }: { imports = [ - #./dhcp.nix - #./nat.nix - #./firewall.nix ./users.nix ./networking.nix ./time.nix ./system.nix ./boot.nix + ./dnsmasq.nix + ./ssh.nix ]; } diff --git a/hosts/voyager/modules/dhcp.nix b/hosts/voyager/modules/dhcp.nix deleted file mode 100644 index e69de29..0000000 diff --git a/hosts/voyager/modules/dnsmasq.nix b/hosts/voyager/modules/dnsmasq.nix new file mode 100644 index 0000000..cb1ab63 --- /dev/null +++ b/hosts/voyager/modules/dnsmasq.nix @@ -0,0 +1,19 @@ +_: +{ + services.dnsmasq = { + enable = true; + settings = { + dhcp-range = [ "10.11.1.100,10.11.1.200,12h" ]; + interface = "enp4s0"; + + server = [ "10.11.0.10" ]; + + no-hosts = true; + + dhcp-option = [ + "option:router,10.11.0.1" + "option:dns-server,10.11.0.10" + ]; + }; + }; +} diff --git a/hosts/voyager/modules/firewall.nix b/hosts/voyager/modules/firewall.nix deleted file mode 100644 index e69de29..0000000 diff --git a/hosts/voyager/modules/nat.nix b/hosts/voyager/modules/nat.nix deleted file mode 100644 index e69de29..0000000 diff --git a/hosts/voyager/modules/networking.nix b/hosts/voyager/modules/networking.nix index ff4ba82..e98ed40 100644 --- a/hosts/voyager/modules/networking.nix +++ b/hosts/voyager/modules/networking.nix @@ -2,20 +2,32 @@ _: { networking = { hostName = "voyager"; - networkmanager = { enable = true; }; - firewall = { enable = false; }; - - interfaces = { - eno1 = { - ipv4.addresses = [{ - address = "10.11.0.10"; - prefixLength = 24; - }]; - }; + networkmanager.enable = false; + useDHCP = false; + + interfaces.enp3s0 = { + useDHCP = true; # WAN DHCP }; - defaultGateway = { - address = "10.11.0.1"; - interface = "eno1"; + + interfaces.enp4s0 = { + ipv4.addresses = [{ + address = "10.11.0.1"; + prefixLength = 24; + }]; + }; + + nat = { + enable = true; + externalInterface = "enp3s0"; # WAN + internalInterfaces = [ "enp4s0" ]; # LAN + }; + + firewall = { + enable = true; + + extraCommands = '' + iptables -A nixos-fw -p tcp --dport 22 -s 10.11.0.0/24 -j ACCEPT + ''; }; }; } diff --git a/hosts/voyager/modules/ssh.nix b/hosts/voyager/modules/ssh.nix new file mode 100644 index 0000000..798faae --- /dev/null +++ b/hosts/voyager/modules/ssh.nix @@ -0,0 +1,8 @@ +_: +{ + services = { + openssh = { + enable = true; + }; + }; +}