summary refs log tree commit diff
path: root/modules/services/misc/virtualbox.nix
blob: 00b81b2f3831e08f6eb7cdc394500e15e36847e3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# VirtualBox server
{ config, pkgs, ... }:

with pkgs.lib;

let

  cfg = config.services.virtualbox;

in

{

  ###### interface
  
  options = {
  
    services.virtualbox = {
    
      enable = mkOption {
        default = false;
        description = "Whether to enable the VirtualBox service and other guest additions.";
      };        

    };
    
  };
  

  ###### implementation

  config = mkIf cfg.enable {

    environment.systemPackages = [ ];

    boot.extraModulePackages = [ pkgs.linuxPackages.virtualboxGuestAdditions ];
    
    jobs.virtualbox =
      { description = "VirtualBox service";
      
        startOn = "started udev";

        exec = "${pkgs.linuxPackages.virtualboxGuestAdditions}/sbin/VBoxService";
      };

  };

}