git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/bumblebee: update for new packages
commitcf3202acac9500a192e00b0e2a3b6fdbc97b6153 authorNikolay Amiantov <ab@fmap.me> dateSat 5 Dec 2015, 00:36 (11 years ago) parent95629cf
1 file changed+25−10
nixos/modules/hardware/video/bumblebee.nix+25−10
nixos/modules/hardware/video/bumblebee.nix+25−10
@@ -2,10 +2,20 @@
22
33with lib;
44let
5+ cfg = config.hardware.bumblebee;
6+
57 kernel = config.boot.kernelPackages;
6− bumblebee = if config.hardware.bumblebee.connectDisplay
7− then pkgs.bumblebee_display
8− else pkgs.bumblebee;
8+
9+ useNvidia = cfg.driver == "nvidia";
10+
11+ bumblebee = pkgs.bumblebee.override {
12+ inherit useNvidia;
13+ useDisplayDevice = cfg.connectDisplay;
14+ };
15+
16+ primus = pkgs.primus.override {
17+ inherit useNvidia;
18+ };
919
1020in
1121
@@ -29,6 +39,7 @@ in
2939 type = types.str;
3040 description = ''Group for bumblebee socket'';
3141 };
42+
3243 hardware.bumblebee.connectDisplay = mkOption {
3344 default = false;
3445 type = types.bool;
@@ -40,26 +51,30 @@ in
4051 Only nvidia driver is supported so far.
4152 '';
4253 };
54+
55+ hardware.bumblebee.driver = mkOption {
56+ default = "nvidia";
57+ type = types.enum [ "nvidia" "nouveau" ];
58+ description = ''
59+ Set driver used by bumblebeed. Supported are nouveau and nvidia.
60+ '';
61+ };
4362 };
4463
4564 config = mkIf config.hardware.bumblebee.enable {
4665 boot.blacklistedKernelModules = [ "nouveau" "nvidia" ];
4766 boot.kernelModules = [ "bbswitch" ];
48− boot.extraModulePackages = [ kernel.bbswitch kernel.nvidia_x11 ];
67+ boot.extraModulePackages = [ kernel.bbswitch ] ++ optional useNvidia kernel.nvidia_x11;
4968
50− environment.systemPackages = [ bumblebee pkgs.primus ];
69+ environment.systemPackages = [ bumblebee primus ];
5170
5271 systemd.services.bumblebeed = {
5372 description = "Bumblebee Hybrid Graphics Switcher";
5473 wantedBy = [ "display-manager.service" ];
5574 path = [ kernel.bbswitch bumblebee ];
5675 serviceConfig = {
57− ExecStart = "${bumblebee}/bin/bumblebeed --use-syslog -g ${config.hardware.bumblebee.group}";
58− Restart = "always";
59− RestartSec = 60;
60− CPUSchedulingPolicy = "idle";
76+ ExecStart = "${bumblebee}/bin/bumblebeed --use-syslog -g ${cfg.group} --driver ${cfg.driver}";
6177 };
62− environment.LD_LIBRARY_PATH="/run/opengl-driver/lib/";
6378 environment.MODULE_DIR="/run/current-system/kernel-modules/lib/modules/";
6479 };
6580 };