Merge pull request #5517 from paraseba/bumblebee
Bumblebee config to enable multiple monitors
This commit is contained in:
commit
d957d9e6bc
@ -1,7 +1,13 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
let kernel = config.boot.kernelPackages; in
|
|
||||||
with lib;
|
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;
|
type = types.uniq types.str;
|
||||||
description = ''Group for bumblebee socket'';
|
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 {
|
config = mkIf config.hardware.bumblebee.enable {
|
||||||
@ -30,13 +47,13 @@ with lib;
|
|||||||
boot.kernelModules = [ "bbswitch" ];
|
boot.kernelModules = [ "bbswitch" ];
|
||||||
boot.extraModulePackages = [ kernel.bbswitch kernel.nvidia_x11 ];
|
boot.extraModulePackages = [ kernel.bbswitch kernel.nvidia_x11 ];
|
||||||
|
|
||||||
environment.systemPackages = [ pkgs.bumblebee pkgs.primus ];
|
environment.systemPackages = [ bumblebee pkgs.primus ];
|
||||||
|
|
||||||
systemd.services.bumblebeed = {
|
systemd.services.bumblebeed = {
|
||||||
description = "Bumblebee Hybrid Graphics Switcher";
|
description = "Bumblebee Hybrid Graphics Switcher";
|
||||||
wantedBy = [ "display-manager.service" ];
|
wantedBy = [ "display-manager.service" ];
|
||||||
script = "bumblebeed --use-syslog -g ${config.hardware.bumblebee.group}";
|
script = "bumblebeed --use-syslog -g ${config.hardware.bumblebee.group}";
|
||||||
path = [ kernel.bbswitch pkgs.bumblebee ];
|
path = [ kernel.bbswitch bumblebee ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
RestartSec = 60;
|
RestartSec = 60;
|
||||||
|
@ -31,6 +31,8 @@
|
|||||||
# TODO: Confusing. Perhaps use "SubArch" instead of i686?
|
# TODO: Confusing. Perhaps use "SubArch" instead of i686?
|
||||||
, nvidia_x11_i686 ? null
|
, nvidia_x11_i686 ? null
|
||||||
, virtualgl_i686 ? null
|
, virtualgl_i686 ? null
|
||||||
|
, useDisplayDevice ? false
|
||||||
|
, extraDeviceOptions ? ""
|
||||||
}:
|
}:
|
||||||
with stdenv.lib;
|
with stdenv.lib;
|
||||||
let
|
let
|
||||||
@ -77,15 +79,26 @@ let
|
|||||||
allEnvs = [hostEnv] ++ optional (i686Env != null) i686Env;
|
allEnvs = [hostEnv] ++ optional (i686Env != null) i686Env;
|
||||||
ldPathString = makeLibraryPath allEnvs;
|
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 {
|
in stdenv.mkDerivation {
|
||||||
inherit name;
|
inherit name deviceOptions;
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "http://bumblebee-project.org/${name}.tar.gz";
|
url = "http://bumblebee-project.org/${name}.tar.gz";
|
||||||
sha256 = "03p3gvx99lwlavznrpg9l7jnl1yfg2adcj8jcjj0gxp20wxp060h";
|
sha256 = "03p3gvx99lwlavznrpg9l7jnl1yfg2adcj8jcjj0gxp20wxp060h";
|
||||||
};
|
};
|
||||||
|
|
||||||
patches = [ ./xopts.patch ];
|
patches = [ ./xopts.patch ./nvidia-conf.patch];
|
||||||
|
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
# Substitute the path to the actual modinfo program in module.c.
|
# 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.
|
# Don't use a special group, just reuse wheel.
|
||||||
substituteInPlace configure \
|
substituteInPlace configure \
|
||||||
--replace 'CONF_GID="bumblebee"' 'CONF_GID="wheel"'
|
--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.
|
# 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.2.1/src/bbsecondary.c 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:46:38.017382619 +0100
|
||||||
@@ -149,6 +149,8 @@
|
@@ -149,6 +149,8 @@
|
||||||
"-sharevts",
|
"-sharevts",
|
||||||
"-nolisten", "tcp",
|
"-nolisten", "tcp",
|
||||||
|
@ -11372,6 +11372,11 @@ let
|
|||||||
else null;
|
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 {
|
vkeybd = callPackage ../applications/audio/vkeybd {
|
||||||
inherit (xlibs) libX11;
|
inherit (xlibs) libX11;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user