hwModul.es add common and common-gaming modules

This commit is contained in:
Aly Raffauf 2024-10-20 17:09:03 -04:00
parent 370c786297
commit 12443409c3
12 changed files with 83 additions and 74 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

@ -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

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,9 +15,11 @@
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
];
@ -35,40 +37,11 @@ in {
extraModulePackages = with config.boot.kernelPackages; [acpi_call];
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;
};
# 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 = {
pipewire.wireplumber.configPackages = [
@ -132,19 +105,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 = {
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