nixpkgs/nixos/modules/hardware/video/bumblebee.nix
Corey O'Connor b2f3e10a35 Add primus and extend bumblebee to support 32bit/64bit multilib architectures.
Using primusrun will work as expected in a multilib environment. Even if the initial program
executes a antoehr program of the another architecture. Assuming the program does not modify
LD_LIBRARY_PATH inappropriately.

This does not update virtualgl for seemless multilib. I was unable to get a mixed 64/32 bit
environment to work with VirtualGL. The mechanism VirtualGL uses to inject the fake GL library would
fail if both 32bit and 64 bit libraries were in the environment. Instead the bumblebee package
creates a optirun32 executable that can be used to run a 32bit executable with optimus on a 64 bit
host. This is not created if the host is 32bit.

For my usage, gaming under wine, the primusrun executable works as expected regardless of
32bit/64bit.
2014-11-29 16:42:00 -08:00

50 lines
1.5 KiB
Nix

{ config, lib, pkgs, ... }:
let kernel = config.boot.kernelPackages; in
with 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.
'';
};
hardware.bumblebee.group = mkOption {
default = "wheel";
example = "video";
type = types.uniq types.str;
description = ''Group for bumblebee socket'';
};
};
config = mkIf config.hardware.bumblebee.enable {
boot.blacklistedKernelModules = [ "nouveau" "nvidia" ];
boot.kernelModules = [ "bbswitch" ];
boot.extraModulePackages = [ kernel.bbswitch kernel.nvidia_x11 ];
environment.systemPackages = [ pkgs.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 ];
serviceConfig = {
Restart = "always";
RestartSec = 60;
CPUSchedulingPolicy = "idle";
};
environment.LD_LIBRARY_PATH="/run/opengl-driver/lib/";
environment.MODULE_DIR="/run/current-system/kernel-modules/lib/modules/";
};
};
}