lol

nixos/bumblebee: update for new packages

+25 -10
+25 -10
nixos/modules/hardware/video/bumblebee.nix
··· 2 2 3 3 with lib; 4 4 let 5 + cfg = config.hardware.bumblebee; 6 + 5 7 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 + }; 9 19 10 20 in 11 21 ··· 29 39 type = types.str; 30 40 description = ''Group for bumblebee socket''; 31 41 }; 42 + 32 43 hardware.bumblebee.connectDisplay = mkOption { 33 44 default = false; 34 45 type = types.bool; ··· 40 51 Only nvidia driver is supported so far. 41 52 ''; 42 53 }; 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 + }; 43 62 }; 44 63 45 64 config = mkIf config.hardware.bumblebee.enable { 46 65 boot.blacklistedKernelModules = [ "nouveau" "nvidia" ]; 47 66 boot.kernelModules = [ "bbswitch" ]; 48 - boot.extraModulePackages = [ kernel.bbswitch kernel.nvidia_x11 ]; 67 + boot.extraModulePackages = [ kernel.bbswitch ] ++ optional useNvidia kernel.nvidia_x11; 49 68 50 - environment.systemPackages = [ bumblebee pkgs.primus ]; 69 + environment.systemPackages = [ bumblebee primus ]; 51 70 52 71 systemd.services.bumblebeed = { 53 72 description = "Bumblebee Hybrid Graphics Switcher"; 54 73 wantedBy = [ "display-manager.service" ]; 55 74 path = [ kernel.bbswitch bumblebee ]; 56 75 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}"; 61 77 }; 62 - environment.LD_LIBRARY_PATH="/run/opengl-driver/lib/"; 63 78 environment.MODULE_DIR="/run/current-system/kernel-modules/lib/modules/"; 64 79 }; 65 80 };