Merge pull request #44896 from cdepillabout/vbox-extpack
add derivation for the virtualbox oracle extension pack
This commit is contained in:
commit
9976f37c77
@ -613,6 +613,12 @@ lib.mapAttrs (n: v: v // { shortName = n; }) rec {
|
|||||||
fullName = "Vim License";
|
fullName = "Vim License";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
virtualbox-puel = {
|
||||||
|
fullName = "Oracle VM VirtualBox Extension Pack Personal Use and Evaluation License (PUEL)";
|
||||||
|
url = "https://www.virtualbox.org/wiki/VirtualBox_PUEL";
|
||||||
|
free = false;
|
||||||
|
};
|
||||||
|
|
||||||
vsl10 = spdx {
|
vsl10 = spdx {
|
||||||
spdxId = "VSL-1.0";
|
spdxId = "VSL-1.0";
|
||||||
fullName = "Vovida Software License v1.0";
|
fullName = "Vovida Software License v1.0";
|
||||||
|
@ -6,7 +6,8 @@ let
|
|||||||
cfg = config.virtualisation.virtualbox.host;
|
cfg = config.virtualisation.virtualbox.host;
|
||||||
|
|
||||||
virtualbox = cfg.package.override {
|
virtualbox = cfg.package.override {
|
||||||
inherit (cfg) enableExtensionPack enableHardening headless;
|
inherit (cfg) enableHardening headless;
|
||||||
|
extensionPack = if cfg.enableExtensionPack then pkgs.virtualboxExtpack else null;
|
||||||
};
|
};
|
||||||
|
|
||||||
kernelModules = config.boot.kernelPackages.virtualbox.override {
|
kernelModules = config.boot.kernelPackages.virtualbox.override {
|
||||||
@ -28,6 +29,17 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enableExtensionPack = mkEnableOption "VirtualBox extension pack" // {
|
||||||
|
description = ''
|
||||||
|
Whether to install the Oracle Extension Pack for VirtualBox.
|
||||||
|
|
||||||
|
<important><para>
|
||||||
|
You must set <literal>nixpkgs.config.allowUnfree = true</literal> in
|
||||||
|
order to use this. This requires you accept the VirtualBox PUEL.
|
||||||
|
</para></important>
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
default = pkgs.virtualbox;
|
default = pkgs.virtualbox;
|
||||||
@ -45,8 +57,6 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
enableExtensionPack = mkEnableOption "VirtualBox extension pack";
|
|
||||||
|
|
||||||
enableHardening = mkOption {
|
enableHardening = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
|
@ -293,6 +293,11 @@ let
|
|||||||
"--hostonlyadapter2 vboxnet0"
|
"--hostonlyadapter2 vboxnet0"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# The VirtualBox Oracle Extension Pack lets you use USB 3.0 (xHCI).
|
||||||
|
enableExtensionPackVMFlags = [
|
||||||
|
"--usbxhci on"
|
||||||
|
];
|
||||||
|
|
||||||
dhcpScript = pkgs: ''
|
dhcpScript = pkgs: ''
|
||||||
${pkgs.dhcp}/bin/dhclient \
|
${pkgs.dhcp}/bin/dhclient \
|
||||||
-lf /run/dhcp.leases \
|
-lf /run/dhcp.leases \
|
||||||
@ -323,13 +328,17 @@ let
|
|||||||
headless.services.xserver.enable = false;
|
headless.services.xserver.enable = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
mkVBoxTest = name: testScript: makeTest {
|
vboxVMsWithExtpack = mapAttrs createVM {
|
||||||
|
testExtensionPack.vmFlags = enableExtensionPackVMFlags;
|
||||||
|
};
|
||||||
|
|
||||||
|
mkVBoxTest = useExtensionPack: vms: name: testScript: makeTest {
|
||||||
name = "virtualbox-${name}";
|
name = "virtualbox-${name}";
|
||||||
|
|
||||||
machine = { lib, config, ... }: {
|
machine = { lib, config, ... }: {
|
||||||
imports = let
|
imports = let
|
||||||
mkVMConf = name: val: val.machine // { key = "${name}-config"; };
|
mkVMConf = name: val: val.machine // { key = "${name}-config"; };
|
||||||
vmConfigs = mapAttrsToList mkVMConf vboxVMs;
|
vmConfigs = mapAttrsToList mkVMConf vms;
|
||||||
in [ ./common/user-account.nix ./common/x11.nix ] ++ vmConfigs;
|
in [ ./common/user-account.nix ./common/x11.nix ] ++ vmConfigs;
|
||||||
virtualisation.memorySize = 2048;
|
virtualisation.memorySize = 2048;
|
||||||
virtualisation.virtualbox.host.enable = true;
|
virtualisation.virtualbox.host.enable = true;
|
||||||
@ -337,6 +346,8 @@ let
|
|||||||
users.users.alice.extraGroups = let
|
users.users.alice.extraGroups = let
|
||||||
inherit (config.virtualisation.virtualbox.host) enableHardening;
|
inherit (config.virtualisation.virtualbox.host) enableHardening;
|
||||||
in lib.mkIf enableHardening (lib.singleton "vboxusers");
|
in lib.mkIf enableHardening (lib.singleton "vboxusers");
|
||||||
|
virtualisation.virtualbox.host.enableExtensionPack = useExtensionPack;
|
||||||
|
nixpkgs.config.allowUnfree = useExtensionPack;
|
||||||
};
|
};
|
||||||
|
|
||||||
testScript = ''
|
testScript = ''
|
||||||
@ -353,7 +364,7 @@ let
|
|||||||
return join("\n", grep { $_ !~ /^UUID:/ } split(/\n/, $_[0]))."\n";
|
return join("\n", grep { $_ !~ /^UUID:/ } split(/\n/, $_[0]))."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
${concatStrings (mapAttrsToList (_: getAttr "testSubs") vboxVMs)}
|
${concatStrings (mapAttrsToList (_: getAttr "testSubs") vms)}
|
||||||
|
|
||||||
$machine->waitForX;
|
$machine->waitForX;
|
||||||
|
|
||||||
@ -363,11 +374,11 @@ let
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
meta = with pkgs.stdenv.lib.maintainers; {
|
meta = with pkgs.stdenv.lib.maintainers; {
|
||||||
maintainers = [ aszlig wkennington ];
|
maintainers = [ aszlig wkennington cdepillabout ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
in mapAttrs mkVBoxTest {
|
in mapAttrs (mkVBoxTest false vboxVMs) {
|
||||||
simple-gui = ''
|
simple-gui = ''
|
||||||
createVM_simple;
|
createVM_simple;
|
||||||
$machine->succeed(ru "VirtualBox &");
|
$machine->succeed(ru "VirtualBox &");
|
||||||
@ -473,4 +484,22 @@ in mapAttrs mkVBoxTest {
|
|||||||
destroyVM_test1;
|
destroyVM_test1;
|
||||||
destroyVM_test2;
|
destroyVM_test2;
|
||||||
'';
|
'';
|
||||||
|
} // mapAttrs (mkVBoxTest true vboxVMsWithExtpack) {
|
||||||
|
enable-extension-pack = ''
|
||||||
|
createVM_testExtensionPack;
|
||||||
|
vbm("startvm testExtensionPack");
|
||||||
|
waitForStartup_testExtensionPack;
|
||||||
|
$machine->screenshot("cli_started");
|
||||||
|
waitForVMBoot_testExtensionPack;
|
||||||
|
$machine->screenshot("cli_booted");
|
||||||
|
|
||||||
|
$machine->nest("Checking for privilege escalation", sub {
|
||||||
|
$machine->fail("test -e '/root/VirtualBox VMs'");
|
||||||
|
$machine->fail("test -e '/root/.config/VirtualBox'");
|
||||||
|
$machine->succeed("test -e '/home/alice/VirtualBox VMs'");
|
||||||
|
});
|
||||||
|
|
||||||
|
shutdownVM_testExtensionPack;
|
||||||
|
destroyVM_testExtensionPack;
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
, xorriso, makeself, perl
|
, xorriso, makeself, perl
|
||||||
, javaBindings ? false, jdk ? null
|
, javaBindings ? false, jdk ? null
|
||||||
, pythonBindings ? false, python2 ? null
|
, pythonBindings ? false, python2 ? null
|
||||||
, enableExtensionPack ? false, requireFile ? null, fakeroot ? null
|
, extensionPack ? null, fakeroot ? null
|
||||||
, pulseSupport ? false, libpulseaudio ? null
|
, pulseSupport ? false, libpulseaudio ? null
|
||||||
, enableHardening ? false
|
, enableHardening ? false
|
||||||
, headless ? false
|
, headless ? false
|
||||||
@ -19,30 +19,9 @@ with stdenv.lib;
|
|||||||
let
|
let
|
||||||
python = python2;
|
python = python2;
|
||||||
buildType = "release";
|
buildType = "release";
|
||||||
# Manually sha256sum the extensionPack file, must be hex!
|
# Remember to change the extpackRev and version in extpack.nix as well.
|
||||||
# Do not forget to update the hash in ./guest-additions/default.nix!
|
|
||||||
extpack = "d90c1b0c89de19010f7c7fe7a675ac744067baf29a9966b034e97b5b2053b37e";
|
|
||||||
extpackRev = "123301";
|
|
||||||
main = "ee3af129a581ec4c1a3e777e98247f8943e976ce6edd24962bcaa5c53ed1f644";
|
main = "ee3af129a581ec4c1a3e777e98247f8943e976ce6edd24962bcaa5c53ed1f644";
|
||||||
version = "5.2.14";
|
version = "5.2.14";
|
||||||
|
|
||||||
# See https://github.com/NixOS/nixpkgs/issues/672 for details
|
|
||||||
extensionPack = requireFile rec {
|
|
||||||
name = "Oracle_VM_VirtualBox_Extension_Pack-${version}-${toString extpackRev}.vbox-extpack";
|
|
||||||
sha256 = extpack;
|
|
||||||
message = ''
|
|
||||||
In order to use the extension pack, you need to comply with the VirtualBox Personal Use
|
|
||||||
and Evaluation License (PUEL) available at:
|
|
||||||
|
|
||||||
https://www.virtualbox.org/wiki/VirtualBox_PUEL
|
|
||||||
|
|
||||||
Once you have read and if you agree with the license, please use the
|
|
||||||
following command and re-run the installation:
|
|
||||||
|
|
||||||
nix-prefetch-url http://download.virtualbox.org/virtualbox/${version}/${name}
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
in stdenv.mkDerivation {
|
in stdenv.mkDerivation {
|
||||||
name = "virtualbox-${version}";
|
name = "virtualbox-${version}";
|
||||||
|
|
||||||
@ -174,7 +153,7 @@ in stdenv.mkDerivation {
|
|||||||
ln -s "$libexec/$file" $out/bin/$file
|
ln -s "$libexec/$file" $out/bin/$file
|
||||||
done
|
done
|
||||||
|
|
||||||
${optionalString enableExtensionPack ''
|
${optionalString (extensionPack != null) ''
|
||||||
mkdir -p "$share"
|
mkdir -p "$share"
|
||||||
"${fakeroot}/bin/fakeroot" "${stdenv.shell}" <<EXTHELPER
|
"${fakeroot}/bin/fakeroot" "${stdenv.shell}" <<EXTHELPER
|
||||||
"$libexec/VBoxExtPackHelperApp" install \
|
"$libexec/VBoxExtPackHelperApp" install \
|
||||||
|
20
pkgs/applications/virtualization/virtualbox/extpack.nix
Normal file
20
pkgs/applications/virtualization/virtualbox/extpack.nix
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{stdenv, fetchurl, lib}:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let extpackRev = "123301";
|
||||||
|
version = "5.2.14";
|
||||||
|
in
|
||||||
|
fetchurl rec {
|
||||||
|
name = "Oracle_VM_VirtualBox_Extension_Pack-${version}-${toString extpackRev}.vbox-extpack";
|
||||||
|
url = "http://download.virtualbox.org/virtualbox/${version}/${name}";
|
||||||
|
sha256 = "d90c1b0c89de19010f7c7fe7a675ac744067baf29a9966b034e97b5b2053b37e";
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "Oracle Extension pack for VirtualBox";
|
||||||
|
license = licenses.virtualbox-puel;
|
||||||
|
homepage = https://www.virtualbox.org/;
|
||||||
|
maintainers = with maintainers; [ flokli sander cdepillabout ];
|
||||||
|
platforms = [ "x86_64-linux" "i686-linux" ];
|
||||||
|
};
|
||||||
|
}
|
@ -18838,7 +18838,6 @@ with pkgs;
|
|||||||
virtualbox = callPackage ../applications/virtualization/virtualbox {
|
virtualbox = callPackage ../applications/virtualization/virtualbox {
|
||||||
stdenv = stdenv_32bit;
|
stdenv = stdenv_32bit;
|
||||||
inherit (gnome2) libIDL;
|
inherit (gnome2) libIDL;
|
||||||
enableExtensionPack = config.virtualbox.enableExtensionPack or false;
|
|
||||||
pulseSupport = config.pulseaudio or true;
|
pulseSupport = config.pulseaudio or true;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -18851,6 +18850,12 @@ with pkgs;
|
|||||||
headless = true;
|
headless = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
virtualboxExtpack = callPackage ../applications/virtualization/virtualbox/extpack.nix { };
|
||||||
|
|
||||||
|
virtualboxWithExtpack = lowPrio (virtualbox.override {
|
||||||
|
extensionPack = virtualboxExtpack;
|
||||||
|
});
|
||||||
|
|
||||||
virtualglLib = callPackage ../tools/X11/virtualgl/lib.nix {
|
virtualglLib = callPackage ../tools/X11/virtualgl/lib.nix {
|
||||||
fltk = fltk13;
|
fltk = fltk13;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user