summary refs log tree commit diff
path: root/nixos/modules/hardware/video/bumblebee.nix
diff options
context:
space:
mode:
authorNikolay Amiantov <ab@fmap.me>2016-11-22 02:33:39 +0300
committerNikolay Amiantov <ab@fmap.me>2016-11-22 02:35:12 +0300
commit42a180352fb3c9e069fd6e41a6387cb548a054c2 (patch)
tree80f80fefa9869aca619aa503357658199db78ce9 /nixos/modules/hardware/video/bumblebee.nix
parente4a1b76457d6c078cd60f8df84fea89a26dedd7b (diff)
downloadnixpkgs-42a180352fb3c9e069fd6e41a6387cb548a054c2.tar
nixpkgs-42a180352fb3c9e069fd6e41a6387cb548a054c2.tar.gz
nixpkgs-42a180352fb3c9e069fd6e41a6387cb548a054c2.tar.bz2
nixpkgs-42a180352fb3c9e069fd6e41a6387cb548a054c2.tar.lz
nixpkgs-42a180352fb3c9e069fd6e41a6387cb548a054c2.tar.xz
nixpkgs-42a180352fb3c9e069fd6e41a6387cb548a054c2.tar.zst
nixpkgs-42a180352fb3c9e069fd6e41a6387cb548a054c2.zip
bumblebee service: replace bbswitch option with pmMethod
I added this option just today, so I don't think this needs a rename entry.
Diffstat (limited to 'nixos/modules/hardware/video/bumblebee.nix')
-rw-r--r--nixos/modules/hardware/video/bumblebee.nix17
1 files changed, 9 insertions, 8 deletions
diff --git a/nixos/modules/hardware/video/bumblebee.nix b/nixos/modules/hardware/video/bumblebee.nix
index 34571b344e5..3ce97ad31c2 100644
--- a/nixos/modules/hardware/video/bumblebee.nix
+++ b/nixos/modules/hardware/video/bumblebee.nix
@@ -13,6 +13,8 @@ let
     useDisplayDevice = cfg.connectDisplay;
   };
 
+  useBbswitch = cfg.pmMethod == "bbswitch";
+
   primus = pkgs.primus.override {
     inherit useNvidia;
   };
@@ -61,12 +63,11 @@ in
         '';
       };
 
-      bbswitch = mkOption {
-        default = true;
-        type = types.bool;
+      pmMethod = mkOption {
+        default = "auto";
+        type = types.enum [ "auto" "bbswitch" "nouveau" "switcheroo" "none" ];
         description = ''
-          Set to true if you want to use bbswitch for power management of
-          unused card.
+          Set preferred power management method for unused card.
         '';
       };
 
@@ -75,8 +76,8 @@ in
 
   config = mkIf cfg.enable {
     boot.blacklistedKernelModules = [ "nvidia-drm" "nvidia" "nouveau" ];
-    boot.kernelModules = optional cfg.bbswitch [ "bbswitch" ];
-    boot.extraModulePackages = optional cfg.bbswitch kernel.bbswitch ++ optional useNvidia kernel.nvidia_x11;
+    boot.kernelModules = optional useBbswitch [ "bbswitch" ];
+    boot.extraModulePackages = optional useBbswitch kernel.bbswitch ++ optional useNvidia kernel.nvidia_x11;
 
     environment.systemPackages = [ bumblebee primus ];
 
@@ -85,7 +86,7 @@ in
       wantedBy = [ "multi-user.target" ];
       before = [ "display-manager.service" ];
       serviceConfig = {
-        ExecStart = "${bumblebee}/bin/bumblebeed --use-syslog -g ${cfg.group} --driver ${cfg.driver}";
+        ExecStart = "${bumblebee}/bin/bumblebeed --use-syslog -g ${cfg.group} --driver ${cfg.driver} --pm-method ${cfg.pmMethod}";
       };
     };
   };