summary refs log tree commit diff
path: root/nixos/modules/hardware/video/bumblebee.nix
diff options
context:
space:
mode:
authorSebastián Bernardo Galkin <paraseba@gmail.com>2014-12-20 02:51:24 -0800
committerSebastián Bernardo Galkin <paraseba@gmail.com>2014-12-30 19:17:42 -0800
commit24abe2b2b3f301e3a0185138b87e7a7052828248 (patch)
treed585f134d820c8d259bfda9bf224ab8ad99dd278 /nixos/modules/hardware/video/bumblebee.nix
parentc2af4f3ea8cbeaf30b67e9391c318fce5b555079 (diff)
downloadnixlib-24abe2b2b3f301e3a0185138b87e7a7052828248.tar
nixlib-24abe2b2b3f301e3a0185138b87e7a7052828248.tar.gz
nixlib-24abe2b2b3f301e3a0185138b87e7a7052828248.tar.bz2
nixlib-24abe2b2b3f301e3a0185138b87e7a7052828248.tar.lz
nixlib-24abe2b2b3f301e3a0185138b87e7a7052828248.tar.xz
nixlib-24abe2b2b3f301e3a0185138b87e7a7052828248.tar.zst
nixlib-24abe2b2b3f301e3a0185138b87e7a7052828248.zip
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.
Diffstat (limited to 'nixos/modules/hardware/video/bumblebee.nix')
-rw-r--r--nixos/modules/hardware/video/bumblebee.nix23
1 files changed, 20 insertions, 3 deletions
diff --git a/nixos/modules/hardware/video/bumblebee.nix b/nixos/modules/hardware/video/bumblebee.nix
index 7b48d9d1fcf5..e20ebc3041e7 100644
--- a/nixos/modules/hardware/video/bumblebee.nix
+++ b/nixos/modules/hardware/video/bumblebee.nix
@@ -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;