summary refs log tree commit diff
path: root/nixos/modules/hardware/video/bumblebee.nix
diff options
context:
space:
mode:
authorTomasz Kontusz <tomasz.kontusz@gmail.com>2014-02-08 19:47:51 +0100
committerBjørn Forsman <bjorn.forsman@gmail.com>2014-02-09 15:09:41 +0100
commitfe38031168620d0bc30c0b79f464f3c04c99f9d1 (patch)
tree6f6b7920d8248864465760eaaa8ef71c977fbf33 /nixos/modules/hardware/video/bumblebee.nix
parent48851fa749d634d68eaaa0dcd6c4041615b6c0f0 (diff)
downloadnixpkgs-fe38031168620d0bc30c0b79f464f3c04c99f9d1.tar
nixpkgs-fe38031168620d0bc30c0b79f464f3c04c99f9d1.tar.gz
nixpkgs-fe38031168620d0bc30c0b79f464f3c04c99f9d1.tar.bz2
nixpkgs-fe38031168620d0bc30c0b79f464f3c04c99f9d1.tar.lz
nixpkgs-fe38031168620d0bc30c0b79f464f3c04c99f9d1.tar.xz
nixpkgs-fe38031168620d0bc30c0b79f464f3c04c99f9d1.tar.zst
nixpkgs-fe38031168620d0bc30c0b79f464f3c04c99f9d1.zip
Upgrade bumblebee and add nixos module
 * Bump bumblebee to 3.2.1
 * Remove config.patch - options it added can be passed to ./configure now
 * Remove the provided xorg.conf
   Provided xorg.conf was causing problems for some users,
   and Bumblebee provides its own default configuration anyway.
 * Make secondary X11 log to /var/log/X.bumblebee.log
 * Add a module for bumblebee
Diffstat (limited to 'nixos/modules/hardware/video/bumblebee.nix')
-rw-r--r--nixos/modules/hardware/video/bumblebee.nix41
1 files changed, 41 insertions, 0 deletions
diff --git a/nixos/modules/hardware/video/bumblebee.nix b/nixos/modules/hardware/video/bumblebee.nix
new file mode 100644
index 00000000000..504da2cde85
--- /dev/null
+++ b/nixos/modules/hardware/video/bumblebee.nix
@@ -0,0 +1,41 @@
+{ config, pkgs, ... }:
+
+let kernel = config.boot.kernelPackages; in
+with pkgs.lib;
+
+{
+
+  options = {
+    hardware.bumblebee.enable = mkOption {
+      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.
+      '';
+    };
+  };
+
+  config = mkIf config.hardware.bumblebee.enable {
+    boot.blacklistedKernelModules = [ "nouveau" "nvidia" ];
+    boot.kernelModules = [ "bbswitch" ];
+    boot.extraModulePackages = [ kernel.bbswitch kernel.nvidia_x11 ];
+
+    environment.systemPackages = [ pkgs.bumblebee ];
+
+    systemd.services.bumblebeed = {
+      description = "Bumblebee Hybrid Graphics Switcher";
+      wantedBy = [ "display-manager.service" ];
+      script = "bumblebeed --use-syslog";
+      path = [ kernel.bbswitch pkgs.bumblebee ];
+      serviceConfig = {
+        Restart = "always";
+        RestartSec = 60;
+        CPUSchedulingPolicy = "idle";
+      };
+    };
+  };
+}