Bumblebee config to enable multiple monitors
Added configurations to `bumblebee` package to easy multiple monitors on Optimus machines. The behaviour of the default `bumblebee` package hasn't change, so this change is backwards compatible. Users who want to connect a monitor to their discrete card should use the package `bumblebee_display` instead. Also added new configuration option to nixos bumblebee module: ``` hardware.bumblebee.connectDisplay = true ``` will enable the new configuration, but the default is still false.
This commit is contained in:
parent
c2af4f3ea8
commit
24abe2b2b3
@ -1,7 +1,13 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let kernel = config.boot.kernelPackages; in
|
||||
with lib;
|
||||
let
|
||||
kernel = config.boot.kernelPackages;
|
||||
bumblebee = if config.hardware.bumblebee.connectDisplay
|
||||
then pkgs.bumblebee_display
|
||||
else pkgs.bumblebee;
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
@ -23,6 +29,17 @@ with lib;
|
||||
type = types.uniq types.str;
|
||||
description = ''Group for bumblebee socket'';
|
||||
};
|
||||
hardware.bumblebee.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.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf config.hardware.bumblebee.enable {
|
||||
@ -30,13 +47,13 @@ with lib;
|
||||
boot.kernelModules = [ "bbswitch" ];
|
||||
boot.extraModulePackages = [ kernel.bbswitch kernel.nvidia_x11 ];
|
||||
|
||||
environment.systemPackages = [ pkgs.bumblebee pkgs.primus ];
|
||||
environment.systemPackages = [ bumblebee pkgs.primus ];
|
||||
|
||||
systemd.services.bumblebeed = {
|
||||
description = "Bumblebee Hybrid Graphics Switcher";
|
||||
wantedBy = [ "display-manager.service" ];
|
||||
script = "bumblebeed --use-syslog -g ${config.hardware.bumblebee.group}";
|
||||
path = [ kernel.bbswitch pkgs.bumblebee ];
|
||||
path = [ kernel.bbswitch bumblebee ];
|
||||
serviceConfig = {
|
||||
Restart = "always";
|
||||
RestartSec = 60;
|
||||
|
@ -31,6 +31,8 @@
|
||||
# TODO: Confusing. Perhaps use "SubArch" instead of i686?
|
||||
, nvidia_x11_i686 ? null
|
||||
, virtualgl_i686 ? null
|
||||
, useDisplayDevice ? false
|
||||
, extraDeviceOptions ? ""
|
||||
}:
|
||||
with stdenv.lib;
|
||||
let
|
||||
@ -77,15 +79,26 @@ let
|
||||
allEnvs = [hostEnv] ++ optional (i686Env != null) i686Env;
|
||||
ldPathString = makeLibraryPath allEnvs;
|
||||
|
||||
# By default we don't want to use a display device
|
||||
deviceOptions = if useDisplayDevice
|
||||
then ""
|
||||
else ''
|
||||
|
||||
# Disable display device
|
||||
Option "UseEDID" "false"
|
||||
Option "UseDisplayDevice" "none"
|
||||
''
|
||||
+ extraDeviceOptions;
|
||||
|
||||
in stdenv.mkDerivation {
|
||||
inherit name;
|
||||
inherit name deviceOptions;
|
||||
|
||||
src = fetchurl {
|
||||
url = "http://bumblebee-project.org/${name}.tar.gz";
|
||||
sha256 = "03p3gvx99lwlavznrpg9l7jnl1yfg2adcj8jcjj0gxp20wxp060h";
|
||||
};
|
||||
|
||||
patches = [ ./xopts.patch ];
|
||||
patches = [ ./xopts.patch ./nvidia-conf.patch];
|
||||
|
||||
preConfigure = ''
|
||||
# Substitute the path to the actual modinfo program in module.c.
|
||||
@ -98,6 +111,10 @@ in stdenv.mkDerivation {
|
||||
# Don't use a special group, just reuse wheel.
|
||||
substituteInPlace configure \
|
||||
--replace 'CONF_GID="bumblebee"' 'CONF_GID="wheel"'
|
||||
|
||||
# Apply configuration options
|
||||
substituteInPlace conf/xorg.conf.nvidia \
|
||||
--subst-var deviceOptions
|
||||
'';
|
||||
|
||||
# Build-time dependencies of bumblebeed and optirun.
|
||||
|
11
pkgs/tools/X11/bumblebee/nvidia-conf.patch
Normal file
11
pkgs/tools/X11/bumblebee/nvidia-conf.patch
Normal file
@ -0,0 +1,11 @@
|
||||
--- bumblebee-3.2.1/conf/xorg.conf.nvidia
|
||||
+++ bumblebee-3.2.1/conf/xorg.conf.nvidia
|
||||
@@ -29,6 +29,5 @@ Section "Device"
|
||||
Option "ProbeAllGpus" "false"
|
||||
|
||||
Option "NoLogo" "true"
|
||||
- Option "UseEDID" "false"
|
||||
- Option "UseDisplayDevice" "none"
|
||||
+@deviceOptions@
|
||||
EndSection
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- bumblebee-3.0/src/bbsecondary.c.orig 2012-02-05 00:03:06.003439638 +0100
|
||||
+++ bumblebee-3.0/src/bbsecondary.c 2012-02-05 00:46:38.017382619 +0100
|
||||
--- bumblebee-3.2.1/src/bbsecondary.c 2012-02-05 00:03:06.003439638 +0100
|
||||
+++ bumblebee-3.2.1/src/bbsecondary.c 2012-02-05 00:46:38.017382619 +0100
|
||||
@@ -149,6 +149,8 @@
|
||||
"-sharevts",
|
||||
"-nolisten", "tcp",
|
||||
|
@ -11156,6 +11156,11 @@ let
|
||||
else null;
|
||||
};
|
||||
|
||||
# use if you intend to connect the nvidia card to a monitor
|
||||
bumblebee_display = bumblebee.override {
|
||||
useDisplayDevice = true;
|
||||
};
|
||||
|
||||
vkeybd = callPackage ../applications/audio/vkeybd {
|
||||
inherit (xlibs) libX11;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user