Using a low-power specialisation for laptops

I want to use specialisation so I can easily switch to a system where dedicated graphic card is not active and the all other options related to power saving (such as cpu undervolting, …) are enabled.

I have a laptop with an integrated intel GPU and a nvidia GPU. Has anyone done this or has any idea on how to go about doing this?

  specialisation = {
    disable-dGPU = {
      configuration = {
        boot.extraModprobeConfig = ''
          blacklist nouveau
          options nouveau modeset=0
        '';
  
        services.udev.extraRules = ''
          # Remove NVIDIA USB xHCI Host Controller devices, if present
          ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c0330", ATTR{power/control}="auto", ATTR{remove}="1"
          
          # Remove NVIDIA USB Type-C UCSI devices, if present
          ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c8000", ATTR{power/control}="auto", ATTR{remove}="1"
          
          # Remove NVIDIA Audio devices, if present
          ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x040300", ATTR{power/control}="auto", ATTR{remove}="1"
          
          # Remove NVIDIA VGA/3D controller devices
          ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x03[0-9]*", ATTR{power/control}="auto", ATTR{remove}="1"
        '';
        boot.blacklistedKernelModules = [ "nouveau" "nvidia" "nvidia_drm" "nvidia_modeset" ];
      };
    };
  };

Works perfectly on lenovo legion (unfortunately ext. displays are connected to nvidia GPU, so there is a tradeoff).

1 Like

Thanks for the tip, I changed to a laptop without a Nvidia GPU, but I’ll definitely give a try on another machine!