bumblebee service: make bbswitch optional

This commit is contained in:
Nikolay Amiantov 2016-11-21 17:16:35 +03:00
parent 44808cac65
commit f10ec922e0

View File

@ -22,49 +22,61 @@ in
{ {
options = { options = {
hardware.bumblebee.enable = mkOption { hardware.bumblebee = {
default = false;
type = types.bool;
description = ''
Enable the bumblebee daemon to manage Optimus hybrid video cards.
This should power off secondary GPU until its use is requested
by running an application with optirun.
Only nvidia driver is supported so far. enable = mkOption {
''; default = false;
}; type = types.bool;
hardware.bumblebee.group = mkOption { description = ''
default = "wheel"; Enable the bumblebee daemon to manage Optimus hybrid video cards.
example = "video"; This should power off secondary GPU until its use is requested
type = types.str; by running an application with optirun.
description = ''Group for bumblebee socket''; '';
}; };
hardware.bumblebee.connectDisplay = mkOption { group = mkOption {
default = false; default = "wheel";
type = types.bool; example = "video";
description = '' type = types.str;
Set to true if you intend to connect your discrete card to a description = ''Group for bumblebee socket'';
monitor. This option will set up your Nvidia card for EDID };
discovery and to turn on the monitor signal.
Only nvidia driver is supported so far. connectDisplay = mkOption {
''; default = false;
}; type = types.bool;
description = ''
Set to true if you intend to connect your discrete card to a
monitor. This option will set up your Nvidia card for EDID
discovery and to turn on the monitor signal.
Only nvidia driver is supported so far.
'';
};
driver = mkOption {
default = "nvidia";
type = types.enum [ "nvidia" "nouveau" ];
description = ''
Set driver used by bumblebeed. Supported are nouveau and nvidia.
'';
};
bbswitch = mkOption {
default = true;
type = types.bool;
description = ''
Set to true if you want to use bbswitch for power management of
unused card.
'';
};
hardware.bumblebee.driver = mkOption {
default = "nvidia";
type = types.enum [ "nvidia" "nouveau" ];
description = ''
Set driver used by bumblebeed. Supported are nouveau and nvidia.
'';
}; };
}; };
config = mkIf config.hardware.bumblebee.enable { config = mkIf cfg.enable {
boot.blacklistedKernelModules = [ "nvidia-drm" "nvidia" "nouveau" ]; boot.blacklistedKernelModules = [ "nvidia-drm" "nvidia" "nouveau" ];
boot.kernelModules = [ "bbswitch" ]; boot.kernelModules = optional cfg.bbswitch [ "bbswitch" ];
boot.extraModulePackages = [ kernel.bbswitch ] ++ optional useNvidia kernel.nvidia_x11; boot.extraModulePackages = optional cfg.bbswitch kernel.bbswitch ++ optional useNvidia kernel.nvidia_x11;
environment.systemPackages = [ bumblebee primus ]; environment.systemPackages = [ bumblebee primus ];