virtualbox: Add option to build vboxwebsrv tool
`vboxwebsrv`, a.k.a, Virtualbox Web Service, provides a way to manage VMs via SOAP interface. This is very useful on headless servers.
This commit is contained in:
parent
83c93c8e1c
commit
40c83d1e0a
@ -6,7 +6,7 @@ let
|
||||
cfg = config.virtualisation.virtualbox.host;
|
||||
|
||||
virtualbox = cfg.package.override {
|
||||
inherit (cfg) enableHardening headless;
|
||||
inherit (cfg) enableHardening headless enableWebService;
|
||||
extensionPack = if cfg.enableExtensionPack then pkgs.virtualboxExtpack else null;
|
||||
};
|
||||
|
||||
@ -80,6 +80,14 @@ in
|
||||
and when virtual machines are controlled only via SSH.
|
||||
'';
|
||||
};
|
||||
|
||||
enableWebService = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Build VirtualBox web service tool (vboxwebsrv) to allow managing VMs via other webpage frontend tools. Useful for headless servers.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [{
|
||||
|
@ -2,7 +2,7 @@
|
||||
, libX11, xorgproto, libXext, libXcursor, libXmu, libIDL, SDL, libcap, libGL
|
||||
, libpng, glib, lvm2, libXrandr, libXinerama, libopus, qtbase, qtx11extras
|
||||
, qttools, qtsvg, qtwayland, pkg-config, which, docbook_xsl, docbook_xml_dtd_43
|
||||
, alsa-lib, curl, libvpx, nettools, dbus, substituteAll
|
||||
, alsa-lib, curl, libvpx, nettools, dbus, substituteAll, gsoap, zlib
|
||||
# If open-watcom-bin is not passed, VirtualBox will fall back to use
|
||||
# the shipped alternative sources (assembly).
|
||||
, open-watcom-bin ? null
|
||||
@ -14,6 +14,7 @@
|
||||
, enableHardening ? false
|
||||
, headless ? false
|
||||
, enable32bitGuests ? true
|
||||
, enableWebService ? false
|
||||
}:
|
||||
|
||||
with lib;
|
||||
@ -49,7 +50,8 @@ in stdenv.mkDerivation {
|
||||
++ optional pythonBindings python # Python is needed even when not building bindings
|
||||
++ optional pulseSupport libpulseaudio
|
||||
++ optionals (headless) [ libXrandr libGL ]
|
||||
++ optionals (!headless) [ qtbase qtx11extras libXinerama SDL ];
|
||||
++ optionals (!headless) [ qtbase qtx11extras libXinerama SDL ]
|
||||
++ optionals (enableWebService) [ gsoap zlib ];
|
||||
|
||||
hardeningDisable = [ "format" "fortify" "pic" "stackprotector" ];
|
||||
|
||||
@ -133,6 +135,10 @@ in stdenv.mkDerivation {
|
||||
PATH_QT5_X11_EXTRAS_INC := ${getDev qtx11extras}/include
|
||||
TOOL_QT5_LRC := ${getDev qttools}/bin/lrelease
|
||||
''}
|
||||
${optionalString (enableWebService) ''
|
||||
# fix gsoap missing zlib include and produce errors with --as-needed
|
||||
VBOX_GSOAP_CXX_LIBS := gsoapssl++ z
|
||||
''}
|
||||
LOCAL_CONFIG
|
||||
|
||||
./configure \
|
||||
@ -142,6 +148,7 @@ in stdenv.mkDerivation {
|
||||
${optionalString (!pulseSupport) "--disable-pulse"} \
|
||||
${optionalString (!enableHardening) "--disable-hardening"} \
|
||||
${optionalString (!enable32bitGuests) "--disable-vmmraw"} \
|
||||
${optionalString (enableWebService) "--enable-webservice"} \
|
||||
${optionalString (open-watcom-bin != null) "--with-ow-dir=${open-watcom-bin}"} \
|
||||
--disable-kmods
|
||||
sed -e 's@PKG_CONFIG_PATH=.*@PKG_CONFIG_PATH=${libIDL}/lib/pkgconfig:${glib.dev}/lib/pkgconfig ${libIDL}/bin/libIDL-config-2@' \
|
||||
@ -168,7 +175,7 @@ in stdenv.mkDerivation {
|
||||
-name src -o -exec cp -avt "$libexec" {} +
|
||||
|
||||
mkdir -p $out/bin
|
||||
for file in ${optionalString (!headless) "VirtualBox VBoxSDL rdesktop-vrdp"} VBoxManage VBoxBalloonCtrl VBoxHeadless; do
|
||||
for file in ${optionalString (!headless) "VirtualBox VBoxSDL rdesktop-vrdp"} ${optionalString (enableWebService) "vboxwebsrv"} VBoxManage VBoxBalloonCtrl VBoxHeadless; do
|
||||
echo "Linking $file to /bin"
|
||||
test -x "$libexec/$file"
|
||||
ln -s "$libexec/$file" $out/bin/$file
|
||||
|
Loading…
Reference in New Issue
Block a user