From a2c3d48fed6ed68818ee0267fd236f9d5510e7fa Mon Sep 17 00:00:00 2001 From: transcaffeine Date: Fri, 4 Apr 2025 18:04:57 +0200 Subject: [PATCH 1/2] chore(hosts/backstage): cleanup --- hosts/backstage/boot.nix | 45 ++++++++++++++++++++++ hosts/backstage/configuration.nix | 39 ------------------- hosts/backstage/default.nix | 1 + hosts/backstage/hardware-configuration.nix | 15 -------- hosts/backstage/network.nix | 13 ++++++- 5 files changed, 57 insertions(+), 56 deletions(-) create mode 100644 hosts/backstage/boot.nix diff --git a/hosts/backstage/boot.nix b/hosts/backstage/boot.nix new file mode 100644 index 0000000..abd9a3b --- /dev/null +++ b/hosts/backstage/boot.nix @@ -0,0 +1,45 @@ +{config, lib, ...}: +{ + # Use the systemd-boot EFI boot loader. + boot = { + loader = { + systemd-boot.enable = true; + efi = { + canTouchEfiVariables = true; + efiSysMountPoint = "/boot/efi"; + }; + }; + initrd = { + network = { + enable = true; + ssh = { + enable = true; + port = 22; + authorizedKeys = config.users.users.root.openssh.authorizedKeys.keys; + hostKeys = [ + "/boot/efi/initrd_id_ed25519" + "/boot/efi/initrd_id_rsa4096" + ]; + }; + }; + systemd = { + enable = true; + network = config.systemd.network; + targets.initrd.wants = [ + "systemd-networkd-wait-online@enp1s0.service" + ]; + users.root.shell = "/bin/systemd-tty-ask-password-agent"; + }; + availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" "virtio_pci" "r8169" ]; + kernelModules = [ "dm-snapshot" ]; + luks.devices."backstage" = { + preLVM = true; + device = "/dev/disk/by-uuid/7f3ccd2d-8022-491e-baa1-675805919fd7"; + }; + }; + kernelModules = [ "kvm-intel" ]; + kernelParams = [ + "zfs.zfs_arc_max=1024000000" + ]; + }; +} diff --git a/hosts/backstage/configuration.nix b/hosts/backstage/configuration.nix index 44d1ad3..61aaadf 100644 --- a/hosts/backstage/configuration.nix +++ b/hosts/backstage/configuration.nix @@ -6,45 +6,6 @@ ../../services/sshd ]; - # Use the systemd-boot EFI boot loader. - boot = { - loader = { - systemd-boot.enable = true; - efi = { - canTouchEfiVariables = true; - efiSysMountPoint = "/boot/efi"; - }; - }; - initrd = { - network = { - enable = true; - ssh = { - enable = true; - port = 22; - authorizedKeys = config.users.users.root.openssh.authorizedKeys.keys; - hostKeys = [ - "/boot/efi/initrd_id_ed25519" - "/boot/efi/initrd_id_rsa4096" - ]; - }; - }; - systemd = { - enable = true; - network = { - enable = true; - networks."10-dhcp" = { - matchConfig.Name = "enp1s0"; - DHCP = "yes"; - }; - }; - targets.initrd.wants = [ - "systemd-networkd-wait-online@enp1s0.service" - ]; - users.root.shell = "/bin/systemd-tty-ask-password-agent"; - }; - }; - }; - # Set your time zone. time.timeZone = "Europe/Berlin"; diff --git a/hosts/backstage/default.nix b/hosts/backstage/default.nix index 39a4e28..72b3230 100644 --- a/hosts/backstage/default.nix +++ b/hosts/backstage/default.nix @@ -5,5 +5,6 @@ ./hardware-configuration.nix ./configuration.nix ./network.nix + ./boot.nix ]; } diff --git a/hosts/backstage/hardware-configuration.nix b/hosts/backstage/hardware-configuration.nix index 3d94fc9..a7ba7ae 100644 --- a/hosts/backstage/hardware-configuration.nix +++ b/hosts/backstage/hardware-configuration.nix @@ -5,21 +5,6 @@ [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot = { - initrd = { - availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" "virtio_pci" "r8169" ]; - kernelModules = [ "dm-snapshot" ]; - luks.devices."backstage" = { - preLVM = true; - device = "/dev/disk/by-uuid/7f3ccd2d-8022-491e-baa1-675805919fd7"; - }; - }; - kernelModules = [ "kvm-intel" ]; - kernelParams = [ - "zfs.zfs_arc_max=1024000000" - ]; - }; - fileSystems."/" = { device = "zpool/root"; fsType = "zfs"; diff --git a/hosts/backstage/network.nix b/hosts/backstage/network.nix index e228c1e..a2e3dca 100644 --- a/hosts/backstage/network.nix +++ b/hosts/backstage/network.nix @@ -1,10 +1,19 @@ -{ config, lib, pkgs, modulesPath, ... }: +{ config, lib, ... }: { networking = { useNetworkd = true; - useDHCP = lib.mkDefault true; hostName = "backstage"; hostId = "0ccd2304"; }; + + systemd.network = { + enable = true; + networks = { + "enp1s0" = { + matchConfig.Name = "enp1s0"; + DHCP = "yes"; + }; + }; + }; } From 57de1d9bba27cee2490923d4a63d3e757d817408 Mon Sep 17 00:00:00 2001 From: transcaffeine Date: Sun, 13 Apr 2025 12:00:23 +0200 Subject: [PATCH 2/2] WIP --- hosts/backstage/boot.nix | 8 +++++++- hosts/backstage/configuration.nix | 2 ++ hosts/backstage/network.nix | 32 +++++++++++++++++++++++++++++++ hosts/backstage/radvd.nix | 7 +++++++ 4 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 hosts/backstage/radvd.nix diff --git a/hosts/backstage/boot.nix b/hosts/backstage/boot.nix index abd9a3b..88d32e5 100644 --- a/hosts/backstage/boot.nix +++ b/hosts/backstage/boot.nix @@ -24,7 +24,8 @@ }; systemd = { enable = true; - network = config.systemd.network; + network.enable = true; + network.networks.enp1s0 = config.systemd.network.networks.enp1s0; targets.initrd.wants = [ "systemd-networkd-wait-online@enp1s0.service" ]; @@ -40,6 +41,11 @@ kernelModules = [ "kvm-intel" ]; kernelParams = [ "zfs.zfs_arc_max=1024000000" + "intel_iommu=on" + "pci=assign-busses" ]; +# extraModprobeConfig = '' +# options ixgbe max_vfs=4 allow_unsupported_sfp=1 debug=2 +# ''; }; } diff --git a/hosts/backstage/configuration.nix b/hosts/backstage/configuration.nix index 61aaadf..0c1d306 100644 --- a/hosts/backstage/configuration.nix +++ b/hosts/backstage/configuration.nix @@ -22,6 +22,8 @@ git tmux htop + pciutils + ethtool ]; users.users.root = { diff --git a/hosts/backstage/network.nix b/hosts/backstage/network.nix index a2e3dca..110b076 100644 --- a/hosts/backstage/network.nix +++ b/hosts/backstage/network.nix @@ -9,11 +9,43 @@ systemd.network = { enable = true; + links = { + "enp1s0" = { + enable = true; + matchConfig = { + Type = "ether"; + MACAddress = "9c:6b:00:8d:d0:8f"; + }; + linkConfig = { + Name = "enp1s0"; + NamePolicy = ""; + }; + }; + "enp2s0f0" = { + enable = true; + matchConfig = { + Type = "ether"; + MACAddress = "90:e2:ba:2e:ea:70"; + }; + linkConfig.MTUBytes = "9710"; + }; + "enp2s0f1" = { + enable = true; + matchConfig = { + Type = "ether"; + MACAddress = "90:e2:ba:2e:ea:71"; + }; + linkConfig.MTUBytes = "9710"; + }; + }; networks = { "enp1s0" = { matchConfig.Name = "enp1s0"; DHCP = "yes"; }; }; + netdevs = { + + }; }; } diff --git a/hosts/backstage/radvd.nix b/hosts/backstage/radvd.nix new file mode 100644 index 0000000..d6b4407 --- /dev/null +++ b/hosts/backstage/radvd.nix @@ -0,0 +1,7 @@ +{config, pkgs, ...}: +{ +# services.radvd.enable = true; +# services.radvd.config = '' +# interface br-infra +# ''; +}