tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
0
fork
atom
lol
0
fork
atom
overview
issues
pulls
pipelines
nixos/bumblebee: update for new packages
Nikolay Amiantov
10 years ago
cf3202ac
95629cf6
+25
-10
1 changed file
expand all
collapse all
unified
split
nixos
modules
hardware
video
bumblebee.nix
+25
-10
nixos/modules/hardware/video/bumblebee.nix
···
2
2
3
3
with lib;
4
4
let
5
5
+
cfg = config.hardware.bumblebee;
6
6
+
5
7
kernel = config.boot.kernelPackages;
6
6
-
bumblebee = if config.hardware.bumblebee.connectDisplay
7
7
-
then pkgs.bumblebee_display
8
8
-
else pkgs.bumblebee;
8
8
+
9
9
+
useNvidia = cfg.driver == "nvidia";
10
10
+
11
11
+
bumblebee = pkgs.bumblebee.override {
12
12
+
inherit useNvidia;
13
13
+
useDisplayDevice = cfg.connectDisplay;
14
14
+
};
15
15
+
16
16
+
primus = pkgs.primus.override {
17
17
+
inherit useNvidia;
18
18
+
};
9
19
10
20
in
11
21
···
29
39
type = types.str;
30
40
description = ''Group for bumblebee socket'';
31
41
};
42
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
54
+
55
55
+
hardware.bumblebee.driver = mkOption {
56
56
+
default = "nvidia";
57
57
+
type = types.enum [ "nvidia" "nouveau" ];
58
58
+
description = ''
59
59
+
Set driver used by bumblebeed. Supported are nouveau and nvidia.
60
60
+
'';
61
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
48
-
boot.extraModulePackages = [ kernel.bbswitch kernel.nvidia_x11 ];
67
67
+
boot.extraModulePackages = [ kernel.bbswitch ] ++ optional useNvidia kernel.nvidia_x11;
49
68
50
50
-
environment.systemPackages = [ bumblebee pkgs.primus ];
69
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
57
-
ExecStart = "${bumblebee}/bin/bumblebeed --use-syslog -g ${config.hardware.bumblebee.group}";
58
58
-
Restart = "always";
59
59
-
RestartSec = 60;
60
60
-
CPUSchedulingPolicy = "idle";
76
76
+
ExecStart = "${bumblebee}/bin/bumblebeed --use-syslog -g ${cfg.group} --driver ${cfg.driver}";
61
77
};
62
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
};