virtualbox guest module: make x11 optional
This commit is contained in:
parent
c5607ceec5
commit
8ce94b6e89
@ -15,18 +15,27 @@ in
|
|||||||
|
|
||||||
###### interface
|
###### interface
|
||||||
|
|
||||||
options.virtualisation.virtualbox.guest.enable = mkOption {
|
options.virtualisation.virtualbox.guest = {
|
||||||
|
enable = mkOption {
|
||||||
default = false;
|
default = false;
|
||||||
|
type = types.bool;
|
||||||
description = "Whether to enable the VirtualBox service and other guest additions.";
|
description = "Whether to enable the VirtualBox service and other guest additions.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
x11 = mkOption {
|
||||||
|
default = true;
|
||||||
|
type = types.bool;
|
||||||
|
description = "Whether to enable x11 graphics";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
###### implementation
|
###### implementation
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable (mkMerge [{
|
||||||
assertions = [ {
|
assertions = [{
|
||||||
assertion = pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64;
|
assertion = pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64;
|
||||||
message = "Virtualbox not currently supported on ${pkgs.stdenv.system}";
|
message = "Virtualbox not currently supported on ${pkgs.stdenv.system}";
|
||||||
} ];
|
}];
|
||||||
|
|
||||||
environment.systemPackages = [ kernel.virtualboxGuestAdditions ];
|
environment.systemPackages = [ kernel.virtualboxGuestAdditions ];
|
||||||
|
|
||||||
@ -49,6 +58,16 @@ in
|
|||||||
serviceConfig.ExecStart = "@${kernel.virtualboxGuestAdditions}/bin/VBoxService VBoxService --foreground";
|
serviceConfig.ExecStart = "@${kernel.virtualboxGuestAdditions}/bin/VBoxService VBoxService --foreground";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
services.udev.extraRules =
|
||||||
|
''
|
||||||
|
# /dev/vboxuser is necessary for VBoxClient to work. Maybe we
|
||||||
|
# should restrict this to logged-in users.
|
||||||
|
KERNEL=="vboxuser", OWNER="root", GROUP="root", MODE="0666"
|
||||||
|
|
||||||
|
# Allow systemd dependencies on vboxguest.
|
||||||
|
SUBSYSTEM=="misc", KERNEL=="vboxguest", TAG+="systemd"
|
||||||
|
'';
|
||||||
|
} (mkIf cfg.x11 {
|
||||||
services.xserver.videoDrivers = mkOverride 50 [ "virtualbox" "modesetting" ];
|
services.xserver.videoDrivers = mkOverride 50 [ "virtualbox" "modesetting" ];
|
||||||
|
|
||||||
services.xserver.config =
|
services.xserver.config =
|
||||||
@ -69,16 +88,6 @@ in
|
|||||||
PATH=${makeBinPath [ pkgs.gnugrep pkgs.which pkgs.xorg.xorgserver.out ]}:$PATH \
|
PATH=${makeBinPath [ pkgs.gnugrep pkgs.which pkgs.xorg.xorgserver.out ]}:$PATH \
|
||||||
${kernel.virtualboxGuestAdditions}/bin/VBoxClient-all
|
${kernel.virtualboxGuestAdditions}/bin/VBoxClient-all
|
||||||
'';
|
'';
|
||||||
|
})]);
|
||||||
services.udev.extraRules =
|
|
||||||
''
|
|
||||||
# /dev/vboxuser is necessary for VBoxClient to work. Maybe we
|
|
||||||
# should restrict this to logged-in users.
|
|
||||||
KERNEL=="vboxuser", OWNER="root", GROUP="root", MODE="0666"
|
|
||||||
|
|
||||||
# Allow systemd dependencies on vboxguest.
|
|
||||||
SUBSYSTEM=="misc", KERNEL=="vboxguest", TAG+="systemd"
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user