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