# 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";
      };

  };

}

# VirtualBox server
{ config, pkgs, ... }:

with pkgs.lib;

let

  cfg = config.services.virtualbox;
  kernel = config.boot.kernelPackages;

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 = [ kernel.virtualboxGuestAdditions ];

    jobs.virtualbox =
      { description = "VirtualBox service";

        startOn = "started udev";

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

  };

}

Make VirtualBox Guest Additions use the configured kernel.
Make VirtualBox Guest Additions use the configured kernel.

svn path=/nixos/trunk/; revision=29346
