remove nvidia gpu from thinkpad completely
This commit is contained in:
parent
3ebb297306
commit
3a0edac987
1 changed files with 10 additions and 77 deletions
|
|
@ -1,18 +1,5 @@
|
||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
let
|
|
||||||
# Helper function to patch desktop entries for NVIDIA offload
|
|
||||||
patchDesktop = pkg: appName: from: to: lib.hiPrio (
|
|
||||||
pkgs.runCommand "patched-desktop-entry-for-${appName}" {} ''
|
|
||||||
${pkgs.coreutils}/bin/mkdir -p $out/share/applications
|
|
||||||
${pkgs.gnused}/bin/sed 's#${from}#${to}#g' < ${pkg}/share/applications/${appName}.desktop > $out/share/applications/${appName}.desktop
|
|
||||||
''
|
|
||||||
);
|
|
||||||
|
|
||||||
# Wrapper to automatically run applications with NVIDIA offload
|
|
||||||
GPUOffloadApp = pkg: desktopName: patchDesktop pkg desktopName "^Exec=" "Exec=nvidia-offload ";
|
|
||||||
in
|
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
|
|
@ -44,10 +31,13 @@ in
|
||||||
"mem_sleep_default=deep"
|
"mem_sleep_default=deep"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Blacklist NVIDIA kernel modules to disable discrete GPU completely
|
||||||
|
boot.blacklistedKernelModules = [ "nouveau" "nvidia" "nvidia_drm" "nvidia_modeset" "nvidia_uvm" ];
|
||||||
|
|
||||||
# Enable firmware updates
|
# Enable firmware updates
|
||||||
services.fwupd.enable = true;
|
services.fwupd.enable = true;
|
||||||
|
|
||||||
# Hardware support for ThinkPad P14s Gen 2 Intel
|
# Hardware support for ThinkPad P14s Gen 2 Intel (Intel graphics only)
|
||||||
hardware = {
|
hardware = {
|
||||||
enableRedistributableFirmware = true;
|
enableRedistributableFirmware = true;
|
||||||
cpu.intel.updateMicrocode = true;
|
cpu.intel.updateMicrocode = true;
|
||||||
|
|
@ -64,39 +54,6 @@ in
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
# NVIDIA configuration (T500)
|
|
||||||
nvidia = {
|
|
||||||
# Modesetting is required for PRIME
|
|
||||||
modesetting.enable = true;
|
|
||||||
|
|
||||||
# Power management (experimental but useful for laptops)
|
|
||||||
powerManagement.enable = true;
|
|
||||||
powerManagement.finegrained = true;
|
|
||||||
|
|
||||||
# Use proprietary driver (open source doesn't support T500 well)
|
|
||||||
open = false;
|
|
||||||
|
|
||||||
# Enable nvidia-settings application
|
|
||||||
nvidiaSettings = true;
|
|
||||||
|
|
||||||
# Use production driver (more stable than latest)
|
|
||||||
package = config.boot.kernelPackages.nvidiaPackages.production;
|
|
||||||
|
|
||||||
# PRIME Offload configuration (better battery life)
|
|
||||||
prime = {
|
|
||||||
offload = {
|
|
||||||
enable = true;
|
|
||||||
enableOffloadCmd = true; # Provides nvidia-offload command
|
|
||||||
};
|
|
||||||
|
|
||||||
# Bus IDs - MUST be verified after installation with:
|
|
||||||
# lspci | grep -E 'VGA|3D'
|
|
||||||
# These are typical values but may differ
|
|
||||||
intelBusId = "PCI:0:2:0";
|
|
||||||
nvidiaBusId = "PCI:1:0:0";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# Bluetooth support
|
# Bluetooth support
|
||||||
bluetooth = {
|
bluetooth = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
@ -136,21 +93,6 @@ in
|
||||||
services.displayManager.gdm.enable = true;
|
services.displayManager.gdm.enable = true;
|
||||||
services.desktopManager.gnome.enable = true;
|
services.desktopManager.gnome.enable = true;
|
||||||
|
|
||||||
# Enable NVIDIA video drivers
|
|
||||||
services.xserver.videoDrivers = [ "nvidia" ];
|
|
||||||
|
|
||||||
# Steam gaming configuration
|
|
||||||
programs.steam = {
|
|
||||||
enable = true;
|
|
||||||
remotePlay.openFirewall = true;
|
|
||||||
dedicatedServer.openFirewall = true;
|
|
||||||
localNetworkGameTransfers.openFirewall = true;
|
|
||||||
gamescopeSession.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
# Enable GameMode for performance optimization
|
|
||||||
programs.gamemode.enable = true;
|
|
||||||
|
|
||||||
# Keyboard layout
|
# Keyboard layout
|
||||||
services.xserver.xkb = {
|
services.xserver.xkb = {
|
||||||
layout = "us";
|
layout = "us";
|
||||||
|
|
@ -229,8 +171,8 @@ in
|
||||||
INTEL_GPU_BOOST_FREQ_ON_BAT = 1100;
|
INTEL_GPU_BOOST_FREQ_ON_BAT = 1100;
|
||||||
|
|
||||||
# ThinkPad battery charge thresholds (preserve battery health)
|
# ThinkPad battery charge thresholds (preserve battery health)
|
||||||
START_CHARGE_THRESH_BAT0 = 70;
|
START_CHARGE_THRESH_BAT0 = 80;
|
||||||
STOP_CHARGE_THRESH_BAT0 = 80;
|
STOP_CHARGE_THRESH_BAT0 = 100;
|
||||||
|
|
||||||
# PCIe power management
|
# PCIe power management
|
||||||
RUNTIME_PM_ON_AC = "on";
|
RUNTIME_PM_ON_AC = "on";
|
||||||
|
|
@ -246,7 +188,7 @@ in
|
||||||
Login = {
|
Login = {
|
||||||
HandleLidSwitch = "suspend"; # Suspend on lid close (battery only)
|
HandleLidSwitch = "suspend"; # Suspend on lid close (battery only)
|
||||||
HandleLidSwitchDocked = "ignore";
|
HandleLidSwitchDocked = "ignore";
|
||||||
HandleLidSwitchExternalPower = "ignore";
|
HandleLidSwitchExternalPower = "suspend";
|
||||||
HandlePowerKey = "suspend"; # Suspend on power button press
|
HandlePowerKey = "suspend"; # Suspend on power button press
|
||||||
HandleSuspendKey = "suspend"; # Allow manual suspend from GNOME menu
|
HandleSuspendKey = "suspend"; # Allow manual suspend from GNOME menu
|
||||||
HandleHibernateKey = "ignore";
|
HandleHibernateKey = "ignore";
|
||||||
|
|
@ -300,7 +242,6 @@ in
|
||||||
unzip
|
unzip
|
||||||
|
|
||||||
# GPU monitoring
|
# GPU monitoring
|
||||||
nvtopPackages.nvidia
|
|
||||||
intel-gpu-tools
|
intel-gpu-tools
|
||||||
|
|
||||||
# Laptop utilities
|
# Laptop utilities
|
||||||
|
|
@ -313,14 +254,6 @@ in
|
||||||
# Icon themes for GNOME applications
|
# Icon themes for GNOME applications
|
||||||
adwaita-icon-theme
|
adwaita-icon-theme
|
||||||
hicolor-icon-theme
|
hicolor-icon-theme
|
||||||
|
|
||||||
# Gaming utilities
|
|
||||||
mangohud # Performance overlay for games
|
|
||||||
gamescope # SteamOS session compositing window manager
|
|
||||||
protonup-qt # Proton version manager
|
|
||||||
|
|
||||||
# Steam with NVIDIA offload (patched desktop entry)
|
|
||||||
(GPUOffloadApp config.programs.steam.package "steam")
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue