hwModules: integrate legion go improvements (#138)
Some checks are pending
git-mirror / gitlab-sync (push) Waiting to run
nix-build / adjustor-build (push) Waiting to run
nix-build / clean-install-build (push) Waiting to run
nix-build / hhd-ui-build (push) Waiting to run
nix-build / rofi-bluetooth-build (push) Waiting to run
nix-build / fallarbor-build (push) Waiting to run
nix-build / lavaridge-build (push) Waiting to run
nix-build / mauville-build (push) Waiting to run
nix-build / pacifidlog-build (push) Waiting to run
nix-build / rustboro-build (push) Waiting to run
nix-build / slateport-build (push) Waiting to run
nix-check / fmt-check (push) Waiting to run
nix-check / eval-check (push) Waiting to run

* hwModuled/amd/cpu: switch to zenpower

* hwModules/framework/13/amd-7000: improve format

* hwModules: add common and common-gaming modules

* hwModules/legion/go: killuserProcesses on logout
This commit is contained in:
Aly Raffauf 2024-10-20 17:29:15 -04:00 committed by GitHub
parent 71ca578f61
commit b3e3fda67e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 119 additions and 97 deletions

View file

@ -1,7 +1,5 @@
{lib, ...}: {
boot.loader.systemd-boot.configurationLimit = lib.mkDefault 10;
console.useXkbConfig = true;
hardware.keyboard.qmk.enable = true;
environment.variables.FLAKE = lib.mkDefault "github:alyraffauf/nixcfg";
programs = {
@ -36,26 +34,10 @@
};
};
logind = {
powerKey = "suspend";
powerKeyLongPress = "poweroff";
};
openssh = {
enable = true;
openFirewall = true;
settings.PasswordAuthentication = false;
};
udev.extraRules = ''
# Disable Fn Lock for ThinkPad Trackpoint USB/Bluetooth Keyboard
SUBSYSTEM=="hid", DRIVER=="lenovo", ATTRS{idVendor}=="17ef", ATTRS{idProduct}=="6047|60ee", ATTR{fn_lock}="0"
SUBSYSTEM=="input", ATTRS{id/vendor}=="17ef", ATTRS{id/product}=="6048|60e1", TEST=="/sys/$devpath/device/fn_lock", RUN+="/bin/sh -c 'echo 0 > \"/sys/$devpath/device/fn_lock\"'"
'';
};
zramSwap = {
enable = lib.mkDefault true;
memoryPercent = lib.mkDefault 50;
};
}

View file

@ -146,9 +146,11 @@
common-tailscale = import ./common/tailscale.nix;
common-wifi-profiles = import ./common/wifi.nix;
hw-common = import ./hwModules/common;
hw-common-amd-cpu = import ./hwModules/common/gpu/amd;
hw-common-amd-gpu = import ./hwModules/common/cpu/amd;
hw-common-bluetooth = import ./hwModules/common/bluetooth;
hw-common-gaming = import ./hwModules/common/gaming;
hw-common-intel-cpu = import ./hwModules/common/cpu/intel;
hw-common-intel-gpu = import ./hwModules/common/gpu/intel;
hw-common-laptop = import ./hwModules/common/laptop;

View file

@ -21,10 +21,12 @@ in {
self.nixosModules.common-pkgs
self.nixosModules.common-tailscale
self.nixosModules.common-wifi-profiles
self.nixosModules.hw-common
self.nixosModules.hw-common-amd-cpu
self.nixosModules.hw-common-amd-gpu
self.nixosModules.hw-common-bluetooth
self.nixosModules.hw-common-ssd
self.nixosModules.hw-common-gaming
];
boot = {
@ -44,7 +46,6 @@ in {
};
};
hardware.enableAllFirmware = true;
networking.hostName = "mauville";
services = {

View file

@ -16,6 +16,7 @@
self.nixosModules.common-pkgs
self.nixosModules.common-tailscale
self.nixosModules.common-wifi-profiles
self.nixosModules.hw-common
self.nixosModules.hw-common-bluetooth
self.nixosModules.hw-common-intel-cpu
self.nixosModules.hw-common-intel-gpu
@ -31,7 +32,6 @@
};
};
hardware.enableAllFirmware = true;
networking.hostName = "slateport";
services = {

View file

@ -1,5 +1,19 @@
{lib, ...}: {
boot.kernelModules = ["kvm-amd"];
# Best for Ryzen CPUs
{
config,
lib,
...
}: {
boot = {
blacklistedKernelModules = ["k10temp"]; # Conflicts with zenpower
extraModulePackages = with config.boot.kernelPackages; [zenpower];
kernelModules = [
"kvm-amd"
"zenpower" # Improved temperature monitoring
];
};
hardware.cpu.amd.updateMicrocode = true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}

View file

@ -0,0 +1,26 @@
{lib, ...}: {
console.useXkbConfig = true;
hardware = {
enableAllFirmware = true;
keyboard.qmk.enable = true;
};
services = {
logind = {
powerKey = "suspend";
powerKeyLongPress = "poweroff";
};
udev.extraRules = ''
# Disable Fn Lock for ThinkPad Trackpoint USB/Bluetooth Keyboard
SUBSYSTEM=="hid", DRIVER=="lenovo", ATTRS{idVendor}=="17ef", ATTRS{idProduct}=="6047|60ee", ATTR{fn_lock}="0"
SUBSYSTEM=="input", ATTRS{id/vendor}=="17ef", ATTRS{id/product}=="6048|60e1", TEST=="/sys/$devpath/device/fn_lock", RUN+="/bin/sh -c 'echo 0 > \"/sys/$devpath/device/fn_lock\"'"
'';
};
zramSwap = {
enable = lib.mkDefault true;
memoryPercent = lib.mkDefault 50;
};
}

View file

@ -0,0 +1,42 @@
{lib, ...}: {
boot.kernel.sysctl = {
# Improved file monitoring
"fs.inotify.max_user_instances" = 8192;
"fs.inotify.max_user_watches" = 524288;
# Disable watchdogs for maximum performance at the cost of resiliency
"kernel.nmi_watchdog" = 0;
"kernel.soft_watchdog" = 0;
"kernel.split_lock_mitigate" = 0;
"kernel.watchdog" = 0;
# Network optimizations
"net.core.default_qdisc" = "fq";
"net.ipv4.tcp_congestion_control" = "bbr";
"net.ipv4.tcp_mtu_probing" = lib.mkForce 1;
# Memory management
"vm.dirty_background_bytes" = 134217728;
"vm.dirty_bytes" = 268435456;
"vm.max_map_count" = lib.mkForce 2147483642;
"vm.page-cluster" = 0;
"vm.swappiness" = 180;
"vm.watermark_boost_factor" = 0;
"vm.watermark_scale_factor" = 125;
};
services.udev.extraRules = ''
# Significantly improved I/O performance
## SSD
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="kyber"
## NVME
ACTION=="add|change", KERNEL=="nvme[0-9]n[0-9]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="kyber"
## MicroSD
ACTION=="add|change", KERNEL=="mmcblk[0-9]p[0-9]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="bfq"
## HDD
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="bfq"
'';
}

View file

@ -7,6 +7,7 @@
imports = [
../../common.nix
../common.nix
self.nixosModules.hw-common
self.nixosModules.hw-common-amd-cpu
self.nixosModules.hw-common-amd-gpu
self.nixosModules.hw-common-bluetooth
@ -16,15 +17,20 @@
boot = {
initrd.availableKernelModules = ["nvme" "sd_mod" "thunderbolt" "usb_storage" "xhci_pci"];
extraModprobeConfig = ''
options snd_hda_intel power_save=1
'';
kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
};
networking.networkmanager = {
enable = true;
wifi.powersave = true;
wifi.backend = "iwd";
wifi = {
backend = "iwd";
powersave = true;
};
};
}

View file

@ -7,6 +7,7 @@
imports = [
../../common.nix
../common.nix
self.nixosModules.hw-common
self.nixosModules.hw-common-bluetooth
self.nixosModules.hw-common-intel-cpu
self.nixosModules.hw-common-intel-gpu

View file

@ -18,10 +18,7 @@
environment.systemPackages = [pkgs.framework-tool] ++ lib.optional (pkgs ? "fw-ectool") pkgs.fw-ectool;
hardware = {
enableAllFirmware = true;
sensor.iio.enable = true;
};
hardware.sensor.iio.enable = true;
services = {
fprintd.enable = true;

View file

@ -15,70 +15,37 @@
convolverPath = "${legion-go-tricks}/experimental_sound_fix/multiwayCor48.wav";
in {
imports = [
self.nixosModules.hw-common
self.nixosModules.hw-common-amd-cpu
self.nixosModules.hw-common-amd-gpu
self.nixosModules.hw-common-bluetooth
self.nixosModules.hw-common-gaming
self.nixosModules.hw-common-ssd
];
boot = {
initrd = {
availableKernelModules = [
"amdgpu"
"nvme"
"rtsx_pci_sdmmc"
"sd_mod"
"sdhci_pci"
"thunderbolt"
"usb_storage"
"usbhid"
"xhci_pci"
];
initrd.availableKernelModules = [
"nvme"
"rtsx_pci_sdmmc"
"sd_mod"
"sdhci_pci"
"thunderbolt"
"usb_storage"
"usbhid"
"xhci_pci"
];
kernelModules = ["amdgpu"];
};
blacklistedKernelModules = ["k10temp"]; # Conflicts with zenpower
extraModulePackages = with config.boot.kernelPackages; [acpi_call zenpower];
kernel.sysctl = {
# Improved file monitoring
"fs.inotify.max_user_instances" = 8192;
"fs.inotify.max_user_watches" = 524288;
# Disable watchdogs for maximum performance at the cost of resiliency
"kernel.nmi_watchdog" = 0;
"kernel.soft_watchdog" = 0;
"kernel.split_lock_mitigate" = 0;
"kernel.watchdog" = 0;
# Network optimizations
"net.core.default_qdisc" = "fq";
"net.ipv4.tcp_congestion_control" = "bbr";
"net.ipv4.tcp_mtu_probing" = lib.mkForce 1;
# Memory management
"vm.dirty_background_bytes" = 134217728;
"vm.dirty_bytes" = 268435456;
"vm.max_map_count" = lib.mkForce 2147483642;
"vm.page-cluster" = 0;
"vm.swappiness" = 180;
"vm.watermark_boost_factor" = 0;
"vm.watermark_scale_factor" = 125;
};
kernelModules = ["zenpower"]; # Improved temperature monitoring
extraModulePackages = with config.boot.kernelPackages; [acpi_call];
# Xanmod seems more responsive under load
kernelPackages = lib.mkDefault pkgs.linuxPackages_xanmod_latest;
};
hardware = {
enableAllFirmware = true;
sensor.iio.enable = true;
};
hardware.sensor.iio.enable = true;
services = {
logind.killUserProcesses = true;
pipewire.wireplumber.configPackages = [
(pkgs.writeTextDir "share/pipewire/pipewire.conf.d/10-legion-go-convolver.conf" ''
# Convolver Configuration for Pipewire
@ -140,19 +107,6 @@ in {
udev.extraRules = ''
# Lenovo Legion Go Controller
ACTION=="add", ATTRS{idVendor}=="17ef", ATTRS{idProduct}=="6182", RUN+="${pkgs.kmod}/bin/modprobe xpad" RUN+="/bin/sh -c 'echo 17ef 6182 > /sys/bus/usb/drivers/xpad/new_id'"
# Significantly improved I/O performance
## SSD
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="kyber"
## NVME
ACTION=="add|change", KERNEL=="nvme[0-9]n[0-9]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="kyber"
## MicroSD
ACTION=="add|change", KERNEL=="mmcblk[0-9]p[0-9]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="bfq"
## HDD
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="bfq"
'';
upower.enable = true;

View file

@ -1,10 +1,6 @@
{...}: {
hardware = {
enableAllFirmware = true;
trackpoint = {
enable = true;
emulateWheel = true;
};
hardware.trackpoint = {
enable = true;
emulateWheel = true;
};
}

View file

@ -1,6 +1,7 @@
{self, ...}: {
imports = [
../common.nix
self.nixosModules.hw-common
self.nixosModules.hw-common-bluetooth
self.nixosModules.hw-common-intel-cpu
self.nixosModules.hw-common-intel-gpu