···2222{
23232424 options = {
2525- hardware.bumblebee.enable = mkOption {
2626- default = false;
2727- type = types.bool;
2828- description = ''
2929- Enable the bumblebee daemon to manage Optimus hybrid video cards.
3030- This should power off secondary GPU until its use is requested
3131- by running an application with optirun.
2525+ hardware.bumblebee = {
32263333- Only nvidia driver is supported so far.
3434- '';
3535- };
3636- hardware.bumblebee.group = mkOption {
3737- default = "wheel";
3838- example = "video";
3939- type = types.str;
4040- description = ''Group for bumblebee socket'';
4141- };
2727+ enable = mkOption {
2828+ default = false;
2929+ type = types.bool;
3030+ description = ''
3131+ Enable the bumblebee daemon to manage Optimus hybrid video cards.
3232+ This should power off secondary GPU until its use is requested
3333+ by running an application with optirun.
3434+ '';
3535+ };
42364343- hardware.bumblebee.connectDisplay = mkOption {
4444- default = false;
4545- type = types.bool;
4646- description = ''
4747- Set to true if you intend to connect your discrete card to a
4848- monitor. This option will set up your Nvidia card for EDID
4949- discovery and to turn on the monitor signal.
3737+ group = mkOption {
3838+ default = "wheel";
3939+ example = "video";
4040+ type = types.str;
4141+ description = ''Group for bumblebee socket'';
4242+ };
50435151- Only nvidia driver is supported so far.
5252- '';
5353- };
4444+ connectDisplay = mkOption {
4545+ default = false;
4646+ type = types.bool;
4747+ description = ''
4848+ Set to true if you intend to connect your discrete card to a
4949+ monitor. This option will set up your Nvidia card for EDID
5050+ discovery and to turn on the monitor signal.
5151+5252+ Only nvidia driver is supported so far.
5353+ '';
5454+ };
5555+5656+ driver = mkOption {
5757+ default = "nvidia";
5858+ type = types.enum [ "nvidia" "nouveau" ];
5959+ description = ''
6060+ Set driver used by bumblebeed. Supported are nouveau and nvidia.
6161+ '';
6262+ };
6363+6464+ bbswitch = mkOption {
6565+ default = true;
6666+ type = types.bool;
6767+ description = ''
6868+ Set to true if you want to use bbswitch for power management of
6969+ unused card.
7070+ '';
7171+ };
54725555- hardware.bumblebee.driver = mkOption {
5656- default = "nvidia";
5757- type = types.enum [ "nvidia" "nouveau" ];
5858- description = ''
5959- Set driver used by bumblebeed. Supported are nouveau and nvidia.
6060- '';
6173 };
6274 };
63756464- config = mkIf config.hardware.bumblebee.enable {
7676+ config = mkIf cfg.enable {
6577 boot.blacklistedKernelModules = [ "nvidia-drm" "nvidia" "nouveau" ];
6666- boot.kernelModules = [ "bbswitch" ];
6767- boot.extraModulePackages = [ kernel.bbswitch ] ++ optional useNvidia kernel.nvidia_x11;
7878+ boot.kernelModules = optional cfg.bbswitch [ "bbswitch" ];
7979+ boot.extraModulePackages = optional cfg.bbswitch kernel.bbswitch ++ optional useNvidia kernel.nvidia_x11;
68806981 environment.systemPackages = [ bumblebee primus ];
7082