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.

Changed files
+19 -4
nixos
modules
virtualisation
pkgs
applications
virtualization
virtualbox
+9 -1
nixos/modules/virtualisation/virtualbox-host.nix
···
cfg = config.virtualisation.virtualbox.host;
virtualbox = cfg.package.override {
-
inherit (cfg) enableHardening headless;
extensionPack = if cfg.enableExtensionPack then pkgs.virtualboxExtpack else null;
};
···
description = ''
Use VirtualBox installation without GUI and Qt dependency. Useful to enable on servers
and when virtual machines are controlled only via SSH.
'';
};
};
···
cfg = config.virtualisation.virtualbox.host;
virtualbox = cfg.package.override {
+
inherit (cfg) enableHardening headless enableWebService;
extensionPack = if cfg.enableExtensionPack then pkgs.virtualboxExtpack else null;
};
···
description = ''
Use VirtualBox installation without GUI and Qt dependency. Useful to enable on servers
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.
'';
};
};
+10 -3
pkgs/applications/virtualization/virtualbox/default.nix
···
, 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
# If open-watcom-bin is not passed, VirtualBox will fall back to use
# the shipped alternative sources (assembly).
, open-watcom-bin ? null
···
, enableHardening ? false
, headless ? false
, enable32bitGuests ? true
}:
with lib;
···
++ optional pythonBindings python # Python is needed even when not building bindings
++ optional pulseSupport libpulseaudio
++ optionals (headless) [ libXrandr libGL ]
-
++ optionals (!headless) [ qtbase qtx11extras libXinerama SDL ];
hardeningDisable = [ "format" "fortify" "pic" "stackprotector" ];
···
PATH_QT5_X11_EXTRAS_INC := ${getDev qtx11extras}/include
TOOL_QT5_LRC := ${getDev qttools}/bin/lrelease
''}
LOCAL_CONFIG
./configure \
···
${optionalString (!pulseSupport) "--disable-pulse"} \
${optionalString (!enableHardening) "--disable-hardening"} \
${optionalString (!enable32bitGuests) "--disable-vmmraw"} \
${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@' \
···
-name src -o -exec cp -avt "$libexec" {} +
mkdir -p $out/bin
-
for file in ${optionalString (!headless) "VirtualBox VBoxSDL rdesktop-vrdp"} VBoxManage VBoxBalloonCtrl VBoxHeadless; do
echo "Linking $file to /bin"
test -x "$libexec/$file"
ln -s "$libexec/$file" $out/bin/$file
···
, 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, gsoap, zlib
# If open-watcom-bin is not passed, VirtualBox will fall back to use
# the shipped alternative sources (assembly).
, open-watcom-bin ? null
···
, enableHardening ? false
, headless ? false
, enable32bitGuests ? true
+
, enableWebService ? false
}:
with lib;
···
++ 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 (enableWebService) [ gsoap zlib ];
hardeningDisable = [ "format" "fortify" "pic" "stackprotector" ];
···
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 \
···
${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@' \
···
-name src -o -exec cp -avt "$libexec" {} +
mkdir -p $out/bin
+
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