|
| 1 | +{ |
| 2 | + lib, |
| 3 | + config, |
| 4 | + ... |
| 5 | +}: |
| 6 | +{ |
| 7 | + imports = [ |
| 8 | + ../../../common/cpu/intel |
| 9 | + ../../../common/gpu/nvidia/prime.nix |
| 10 | + ../../../common/gpu/nvidia/ada-lovelace |
| 11 | + ../../../common/pc/laptop |
| 12 | + ../../../common/pc/ssd |
| 13 | + ../../../common/hidpi.nix |
| 14 | + ]; |
| 15 | + |
| 16 | + boot.initrd.kernelModules = [ "nvidia" ]; |
| 17 | + boot.extraModulePackages = [ |
| 18 | + config.boot.kernelPackages.lenovo-legion-module |
| 19 | + config.boot.kernelPackages.nvidia_x11 |
| 20 | + ]; |
| 21 | + |
| 22 | + # Comprehensive audio fixes for Legion Pro 7 16IRX8H |
| 23 | + # This model has both Realtek ALC287 and TAS2781 audio components |
| 24 | + boot.kernelParams = [ |
| 25 | + # Basic audio MSI support |
| 26 | + "snd_hda_intel.enable_msi=1" |
| 27 | + # Legion-specific audio model |
| 28 | + "snd_hda_intel.model=legion-y7000" |
| 29 | + # TAS2781 audio codec fixes for calibration CRC errors |
| 30 | + "snd_hda_intel.patch=tas2781-fix,hp-mute-led-micx" |
| 31 | + "snd_soc_tas2781.reset_calib=1" |
| 32 | + # Hardware fixes |
| 33 | + "tsc=reliable" # Fix TSC ADJUST firmware bugs common on Legion laptops |
| 34 | + # ACPI thermal management fixes for Legion BIOS issues |
| 35 | + "acpi.debug_layer=0x2" |
| 36 | + "acpi.debug_level=0x2" |
| 37 | + "processor.ignore_ppc=1" |
| 38 | + # Bluetooth LE Audio/BAP support (Legion has modern Bluetooth) |
| 39 | + "bluetooth.enable_iso=1" |
| 40 | + ]; |
| 41 | + |
| 42 | + # Additional audio configuration for Legion Pro 7 |
| 43 | + boot.extraModprobeConfig = '' |
| 44 | + # Force specific Legion audio model for proper speaker routing |
| 45 | + options snd-hda-intel model=lenovo-legion-7i |
| 46 | + ''; |
| 47 | + |
| 48 | + # Enable Bluetooth modules for LE Audio support |
| 49 | + boot.kernelModules = [ "bluetooth" "btusb" ]; |
| 50 | + |
| 51 | + hardware = { |
| 52 | + nvidia = { |
| 53 | + modesetting.enable = lib.mkDefault true; |
| 54 | + powerManagement.enable = lib.mkDefault true; |
| 55 | + prime = { |
| 56 | + intelBusId = "PCI:00:02:0"; |
| 57 | + nvidiaBusId = "PCI:01:00:0"; |
| 58 | + }; |
| 59 | + }; |
| 60 | + |
| 61 | + # Enable Bluetooth with Legion-optimized settings |
| 62 | + bluetooth = { |
| 63 | + enable = lib.mkDefault true; |
| 64 | + powerOnBoot = lib.mkDefault false; # Save battery |
| 65 | + settings = { |
| 66 | + General = { |
| 67 | + ControllerMode = "dual"; |
| 68 | + FastConnectable = "true"; |
| 69 | + Experimental = "true"; # Enable LE Audio features |
| 70 | + KernelExperimental = "true"; # Enable ISO socket support |
| 71 | + }; |
| 72 | + }; |
| 73 | + }; |
| 74 | + }; |
| 75 | + |
| 76 | + # Cooling management for Legion laptops |
| 77 | + services.thermald.enable = lib.mkDefault true; |
| 78 | + |
| 79 | + # Audio group permissions |
| 80 | + users.groups.audio = {}; |
| 81 | + |
| 82 | + # √(2560² + 1600²) px / 16 in ≃ 189 dpi |
| 83 | + services.xserver.dpi = 189; |
| 84 | +} |
0 commit comments