3 let kernel = config.boot.kernelPackages; in
11 hardware.nvidiaOptimus.disable = lib.mkOption {
13 type = lib.types.bool;
14 description = lib.mdDoc ''
15 Completely disable the NVIDIA graphics card and use the
16 integrated graphics processor instead.
25 config = lib.mkIf config.hardware.nvidiaOptimus.disable {
26 boot.blacklistedKernelModules = ["nouveau" "nvidia" "nvidiafb" "nvidia-drm"];
27 boot.kernelModules = [ "bbswitch" ];
28 boot.extraModulePackages = [ kernel.bbswitch ];
30 systemd.services.bbswitch = {
31 description = "Disable NVIDIA Card";
32 wantedBy = [ "multi-user.target" ];
35 RemainAfterExit = true;
36 ExecStart = "${kernel.bbswitch}/bin/discrete_vga_poweroff";
37 ExecStop = "${kernel.bbswitch}/bin/discrete_vga_poweron";
39 path = [ kernel.bbswitch ];