tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
virtualbox guest module: make x11 optional
Jaka Hudoklin
9 years ago
8ce94b6e
c5607cee
+26
-17
1 changed file
expand all
collapse all
unified
split
nixos
modules
virtualisation
virtualbox-guest.nix
+26
-17
nixos/modules/virtualisation/virtualbox-guest.nix
···
15
15
16
16
###### interface
17
17
18
18
-
options.virtualisation.virtualbox.guest.enable = mkOption {
19
19
-
default = false;
20
20
-
description = "Whether to enable the VirtualBox service and other guest additions.";
18
18
+
options.virtualisation.virtualbox.guest = {
19
19
+
enable = mkOption {
20
20
+
default = false;
21
21
+
type = types.bool;
22
22
+
description = "Whether to enable the VirtualBox service and other guest additions.";
23
23
+
};
24
24
+
25
25
+
x11 = mkOption {
26
26
+
default = true;
27
27
+
type = types.bool;
28
28
+
description = "Whether to enable x11 graphics";
29
29
+
};
21
30
};
22
31
23
32
###### implementation
24
33
25
25
-
config = mkIf cfg.enable {
26
26
-
assertions = [ {
34
34
+
config = mkIf cfg.enable (mkMerge [{
35
35
+
assertions = [{
27
36
assertion = pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64;
28
37
message = "Virtualbox not currently supported on ${pkgs.stdenv.system}";
29
29
-
} ];
38
38
+
}];
30
39
31
40
environment.systemPackages = [ kernel.virtualboxGuestAdditions ];
32
41
···
49
58
serviceConfig.ExecStart = "@${kernel.virtualboxGuestAdditions}/bin/VBoxService VBoxService --foreground";
50
59
};
51
60
61
61
+
services.udev.extraRules =
62
62
+
''
63
63
+
# /dev/vboxuser is necessary for VBoxClient to work. Maybe we
64
64
+
# should restrict this to logged-in users.
65
65
+
KERNEL=="vboxuser", OWNER="root", GROUP="root", MODE="0666"
66
66
+
67
67
+
# Allow systemd dependencies on vboxguest.
68
68
+
SUBSYSTEM=="misc", KERNEL=="vboxguest", TAG+="systemd"
69
69
+
'';
70
70
+
} (mkIf cfg.x11 {
52
71
services.xserver.videoDrivers = mkOverride 50 [ "virtualbox" "modesetting" ];
53
72
54
73
services.xserver.config =
···
69
88
PATH=${makeBinPath [ pkgs.gnugrep pkgs.which pkgs.xorg.xorgserver.out ]}:$PATH \
70
89
${kernel.virtualboxGuestAdditions}/bin/VBoxClient-all
71
90
'';
72
72
-
73
73
-
services.udev.extraRules =
74
74
-
''
75
75
-
# /dev/vboxuser is necessary for VBoxClient to work. Maybe we
76
76
-
# should restrict this to logged-in users.
77
77
-
KERNEL=="vboxuser", OWNER="root", GROUP="root", MODE="0666"
78
78
-
79
79
-
# Allow systemd dependencies on vboxguest.
80
80
-
SUBSYSTEM=="misc", KERNEL=="vboxguest", TAG+="systemd"
81
81
-
'';
82
82
-
};
91
91
+
})]);
83
92
84
93
}