diff --git a/nixos/common/modules/udev-rules.nix b/nixos/common/modules/udev-rules.nix new file mode 100644 index 00000000..21a4b1c1 --- /dev/null +++ b/nixos/common/modules/udev-rules.nix @@ -0,0 +1,17 @@ +{ ... }: { + boot.initrd.services.udev.rules = '' + # This is used to load the correct kernel module for the Framework USB-C Ethernet Adapter + + ACTION!="add", GOTO="usb_realtek_net_end" + SUBSYSTEM!="usb", GOTO="usb_realtek_net_end" + ENV{DEVTYPE}!="usb_device", GOTO="usb_realtek_net_end" + + # Modify this to change the default value + ENV{REALTEK_MODE1}="1" + + # Realtek + ATTR{idVendor}=="0bda", ATTR{idProduct}=="815[2,3,5,6]", ATTR{bConfigurationValue}!="$env{REALTEK_MODE1}", ATTR{bConfigurationValue}="$env{REALTEK_MODE1}" + + LABEL="usb_realtek_net_end" + ''; +} \ No newline at end of file diff --git a/nixos/hosts/framework-server/default.nix b/nixos/hosts/framework-server/default.nix index 5f27b6be..4c204c8f 100644 --- a/nixos/hosts/framework-server/default.nix +++ b/nixos/hosts/framework-server/default.nix @@ -5,8 +5,8 @@ (modulesPath + "/installer/scan/not-detected.nix") ./disks.nix ../../common/modules/secureboot.nix + ../../common/modules/udev-rules.nix ../../common/services/fwupd.nix - ../../common/services/forgejo-runner.nix ./builder.nix ./ssh-luks.nix ./docker.nix @@ -53,28 +53,10 @@ boot.kernel.sysctl = { "net.ipv4.ip_forward" = true; }; - environment.systemPackages = with pkgs; [ - iproute2 - ]; + environment.systemPackages = with pkgs; [ iproute2 ]; # Forward mail port 25 to sysctl.io / linode networking.firewall.extraCommands = '' ip route add table 25 0.0.0.0/0 dev wireguard0 ip route add table 25 default via 10.100.0.2 ''; - - boot.initrd.services.udev.rules = '' - # This is used to load the correct kernel module for the Framework USB-C Ethernet Adapter - - ACTION!="add", GOTO="usb_realtek_net_end" - SUBSYSTEM!="usb", GOTO="usb_realtek_net_end" - ENV{DEVTYPE}!="usb_device", GOTO="usb_realtek_net_end" - - # Modify this to change the default value - ENV{REALTEK_MODE1}="1" - - # Realtek - ATTR{idVendor}=="0bda", ATTR{idProduct}=="815[2,3,5,6]", ATTR{bConfigurationValue}!="$env{REALTEK_MODE1}", ATTR{bConfigurationValue}="$env{REALTEK_MODE1}" - - LABEL="usb_realtek_net_end" - ''; } diff --git a/nixos/hosts/nixos-framework/default.nix b/nixos/hosts/nixos-framework/default.nix index 8c3aa012..0f9ef02b 100644 --- a/nixos/hosts/nixos-framework/default.nix +++ b/nixos/hosts/nixos-framework/default.nix @@ -4,6 +4,7 @@ (modulesPath + "/installer/scan/not-detected.nix") ./disks.nix ../../common/modules/secureboot.nix + ../../common/modules/udev-rules.nix ../../common/services/powertop.nix ../../common/services/fwupd.nix ../../common/services/tlp.nix