mirror of
https://github.com/alyraffauf/nixcfg.git
synced 2024-11-21 13:53:56 -05:00
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
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:
parent
71ca578f61
commit
b3e3fda67e
|
@ -1,7 +1,5 @@
|
||||||
{lib, ...}: {
|
{lib, ...}: {
|
||||||
boot.loader.systemd-boot.configurationLimit = lib.mkDefault 10;
|
boot.loader.systemd-boot.configurationLimit = lib.mkDefault 10;
|
||||||
console.useXkbConfig = true;
|
|
||||||
hardware.keyboard.qmk.enable = true;
|
|
||||||
environment.variables.FLAKE = lib.mkDefault "github:alyraffauf/nixcfg";
|
environment.variables.FLAKE = lib.mkDefault "github:alyraffauf/nixcfg";
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
|
@ -36,26 +34,10 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
logind = {
|
|
||||||
powerKey = "suspend";
|
|
||||||
powerKeyLongPress = "poweroff";
|
|
||||||
};
|
|
||||||
|
|
||||||
openssh = {
|
openssh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
openFirewall = true;
|
openFirewall = true;
|
||||||
settings.PasswordAuthentication = false;
|
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;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,9 +146,11 @@
|
||||||
common-tailscale = import ./common/tailscale.nix;
|
common-tailscale = import ./common/tailscale.nix;
|
||||||
common-wifi-profiles = import ./common/wifi.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-cpu = import ./hwModules/common/gpu/amd;
|
||||||
hw-common-amd-gpu = import ./hwModules/common/cpu/amd;
|
hw-common-amd-gpu = import ./hwModules/common/cpu/amd;
|
||||||
hw-common-bluetooth = import ./hwModules/common/bluetooth;
|
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-cpu = import ./hwModules/common/cpu/intel;
|
||||||
hw-common-intel-gpu = import ./hwModules/common/gpu/intel;
|
hw-common-intel-gpu = import ./hwModules/common/gpu/intel;
|
||||||
hw-common-laptop = import ./hwModules/common/laptop;
|
hw-common-laptop = import ./hwModules/common/laptop;
|
||||||
|
|
|
@ -21,10 +21,12 @@ in {
|
||||||
self.nixosModules.common-pkgs
|
self.nixosModules.common-pkgs
|
||||||
self.nixosModules.common-tailscale
|
self.nixosModules.common-tailscale
|
||||||
self.nixosModules.common-wifi-profiles
|
self.nixosModules.common-wifi-profiles
|
||||||
|
self.nixosModules.hw-common
|
||||||
self.nixosModules.hw-common-amd-cpu
|
self.nixosModules.hw-common-amd-cpu
|
||||||
self.nixosModules.hw-common-amd-gpu
|
self.nixosModules.hw-common-amd-gpu
|
||||||
self.nixosModules.hw-common-bluetooth
|
self.nixosModules.hw-common-bluetooth
|
||||||
self.nixosModules.hw-common-ssd
|
self.nixosModules.hw-common-ssd
|
||||||
|
self.nixosModules.hw-common-gaming
|
||||||
];
|
];
|
||||||
|
|
||||||
boot = {
|
boot = {
|
||||||
|
@ -44,7 +46,6 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
hardware.enableAllFirmware = true;
|
|
||||||
networking.hostName = "mauville";
|
networking.hostName = "mauville";
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
self.nixosModules.common-pkgs
|
self.nixosModules.common-pkgs
|
||||||
self.nixosModules.common-tailscale
|
self.nixosModules.common-tailscale
|
||||||
self.nixosModules.common-wifi-profiles
|
self.nixosModules.common-wifi-profiles
|
||||||
|
self.nixosModules.hw-common
|
||||||
self.nixosModules.hw-common-bluetooth
|
self.nixosModules.hw-common-bluetooth
|
||||||
self.nixosModules.hw-common-intel-cpu
|
self.nixosModules.hw-common-intel-cpu
|
||||||
self.nixosModules.hw-common-intel-gpu
|
self.nixosModules.hw-common-intel-gpu
|
||||||
|
@ -31,7 +32,6 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
hardware.enableAllFirmware = true;
|
|
||||||
networking.hostName = "slateport";
|
networking.hostName = "slateport";
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
|
|
|
@ -1,5 +1,19 @@
|
||||||
{lib, ...}: {
|
# Best for Ryzen CPUs
|
||||||
boot.kernelModules = ["kvm-amd"];
|
{
|
||||||
|
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;
|
hardware.cpu.amd.updateMicrocode = true;
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||||
}
|
}
|
||||||
|
|
26
hwModules/common/default.nix
Normal file
26
hwModules/common/default.nix
Normal 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;
|
||||||
|
};
|
||||||
|
}
|
42
hwModules/common/gaming/default.nix
Normal file
42
hwModules/common/gaming/default.nix
Normal 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"
|
||||||
|
'';
|
||||||
|
}
|
|
@ -7,6 +7,7 @@
|
||||||
imports = [
|
imports = [
|
||||||
../../common.nix
|
../../common.nix
|
||||||
../common.nix
|
../common.nix
|
||||||
|
self.nixosModules.hw-common
|
||||||
self.nixosModules.hw-common-amd-cpu
|
self.nixosModules.hw-common-amd-cpu
|
||||||
self.nixosModules.hw-common-amd-gpu
|
self.nixosModules.hw-common-amd-gpu
|
||||||
self.nixosModules.hw-common-bluetooth
|
self.nixosModules.hw-common-bluetooth
|
||||||
|
@ -16,15 +17,20 @@
|
||||||
|
|
||||||
boot = {
|
boot = {
|
||||||
initrd.availableKernelModules = ["nvme" "sd_mod" "thunderbolt" "usb_storage" "xhci_pci"];
|
initrd.availableKernelModules = ["nvme" "sd_mod" "thunderbolt" "usb_storage" "xhci_pci"];
|
||||||
|
|
||||||
extraModprobeConfig = ''
|
extraModprobeConfig = ''
|
||||||
options snd_hda_intel power_save=1
|
options snd_hda_intel power_save=1
|
||||||
'';
|
'';
|
||||||
|
|
||||||
kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
|
kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
|
||||||
};
|
};
|
||||||
|
|
||||||
networking.networkmanager = {
|
networking.networkmanager = {
|
||||||
enable = true;
|
enable = true;
|
||||||
wifi.powersave = true;
|
|
||||||
wifi.backend = "iwd";
|
wifi = {
|
||||||
|
backend = "iwd";
|
||||||
|
powersave = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
imports = [
|
imports = [
|
||||||
../../common.nix
|
../../common.nix
|
||||||
../common.nix
|
../common.nix
|
||||||
|
self.nixosModules.hw-common
|
||||||
self.nixosModules.hw-common-bluetooth
|
self.nixosModules.hw-common-bluetooth
|
||||||
self.nixosModules.hw-common-intel-cpu
|
self.nixosModules.hw-common-intel-cpu
|
||||||
self.nixosModules.hw-common-intel-gpu
|
self.nixosModules.hw-common-intel-gpu
|
||||||
|
|
|
@ -18,10 +18,7 @@
|
||||||
|
|
||||||
environment.systemPackages = [pkgs.framework-tool] ++ lib.optional (pkgs ? "fw-ectool") pkgs.fw-ectool;
|
environment.systemPackages = [pkgs.framework-tool] ++ lib.optional (pkgs ? "fw-ectool") pkgs.fw-ectool;
|
||||||
|
|
||||||
hardware = {
|
hardware.sensor.iio.enable = true;
|
||||||
enableAllFirmware = true;
|
|
||||||
sensor.iio.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
fprintd.enable = true;
|
fprintd.enable = true;
|
||||||
|
|
|
@ -15,70 +15,37 @@
|
||||||
convolverPath = "${legion-go-tricks}/experimental_sound_fix/multiwayCor48.wav";
|
convolverPath = "${legion-go-tricks}/experimental_sound_fix/multiwayCor48.wav";
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
|
self.nixosModules.hw-common
|
||||||
self.nixosModules.hw-common-amd-cpu
|
self.nixosModules.hw-common-amd-cpu
|
||||||
self.nixosModules.hw-common-amd-gpu
|
self.nixosModules.hw-common-amd-gpu
|
||||||
self.nixosModules.hw-common-bluetooth
|
self.nixosModules.hw-common-bluetooth
|
||||||
|
self.nixosModules.hw-common-gaming
|
||||||
self.nixosModules.hw-common-ssd
|
self.nixosModules.hw-common-ssd
|
||||||
];
|
];
|
||||||
|
|
||||||
boot = {
|
boot = {
|
||||||
initrd = {
|
initrd.availableKernelModules = [
|
||||||
availableKernelModules = [
|
"nvme"
|
||||||
"amdgpu"
|
"rtsx_pci_sdmmc"
|
||||||
"nvme"
|
"sd_mod"
|
||||||
"rtsx_pci_sdmmc"
|
"sdhci_pci"
|
||||||
"sd_mod"
|
"thunderbolt"
|
||||||
"sdhci_pci"
|
"usb_storage"
|
||||||
"thunderbolt"
|
"usbhid"
|
||||||
"usb_storage"
|
"xhci_pci"
|
||||||
"usbhid"
|
];
|
||||||
"xhci_pci"
|
|
||||||
];
|
|
||||||
|
|
||||||
kernelModules = ["amdgpu"];
|
extraModulePackages = with config.boot.kernelPackages; [acpi_call];
|
||||||
};
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
# Xanmod seems more responsive under load
|
# Xanmod seems more responsive under load
|
||||||
kernelPackages = lib.mkDefault pkgs.linuxPackages_xanmod_latest;
|
kernelPackages = lib.mkDefault pkgs.linuxPackages_xanmod_latest;
|
||||||
};
|
};
|
||||||
|
|
||||||
hardware = {
|
hardware.sensor.iio.enable = true;
|
||||||
enableAllFirmware = true;
|
|
||||||
sensor.iio.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
|
logind.killUserProcesses = true;
|
||||||
|
|
||||||
pipewire.wireplumber.configPackages = [
|
pipewire.wireplumber.configPackages = [
|
||||||
(pkgs.writeTextDir "share/pipewire/pipewire.conf.d/10-legion-go-convolver.conf" ''
|
(pkgs.writeTextDir "share/pipewire/pipewire.conf.d/10-legion-go-convolver.conf" ''
|
||||||
# Convolver Configuration for Pipewire
|
# Convolver Configuration for Pipewire
|
||||||
|
@ -140,19 +107,6 @@ in {
|
||||||
udev.extraRules = ''
|
udev.extraRules = ''
|
||||||
# Lenovo Legion Go Controller
|
# 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'"
|
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;
|
upower.enable = true;
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
{...}: {
|
{...}: {
|
||||||
hardware = {
|
hardware.trackpoint = {
|
||||||
enableAllFirmware = true;
|
enable = true;
|
||||||
|
emulateWheel = true;
|
||||||
trackpoint = {
|
|
||||||
enable = true;
|
|
||||||
emulateWheel = true;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{self, ...}: {
|
{self, ...}: {
|
||||||
imports = [
|
imports = [
|
||||||
../common.nix
|
../common.nix
|
||||||
|
self.nixosModules.hw-common
|
||||||
self.nixosModules.hw-common-bluetooth
|
self.nixosModules.hw-common-bluetooth
|
||||||
self.nixosModules.hw-common-intel-cpu
|
self.nixosModules.hw-common-intel-cpu
|
||||||
self.nixosModules.hw-common-intel-gpu
|
self.nixosModules.hw-common-intel-gpu
|
||||||
|
|
Loading…
Reference in a new issue