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;
|
cfg = config.virtualisation.virtualbox.host;
|
||||||
|
|
||||||
virtualbox = cfg.package.override {
|
virtualbox = cfg.package.override {
|
||||||
inherit (cfg) enableHardening headless;
|
inherit (cfg) enableHardening headless enableWebService;
|
||||||
extensionPack = if cfg.enableExtensionPack then pkgs.virtualboxExtpack else null;
|
extensionPack = if cfg.enableExtensionPack then pkgs.virtualboxExtpack else null;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -80,6 +80,14 @@ in
|
|||||||
and when virtual machines are controlled only via SSH.
|
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 [{
|
config = mkIf cfg.enable (mkMerge [{
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
, libX11, xorgproto, libXext, libXcursor, libXmu, libIDL, SDL, libcap, libGL
|
, libX11, xorgproto, libXext, libXcursor, libXmu, libIDL, SDL, libcap, libGL
|
||||||
, libpng, glib, lvm2, libXrandr, libXinerama, libopus, qtbase, qtx11extras
|
, libpng, glib, lvm2, libXrandr, libXinerama, libopus, qtbase, qtx11extras
|
||||||
, qttools, qtsvg, qtwayland, pkg-config, which, docbook_xsl, docbook_xml_dtd_43
|
, 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
|
# If open-watcom-bin is not passed, VirtualBox will fall back to use
|
||||||
# the shipped alternative sources (assembly).
|
# the shipped alternative sources (assembly).
|
||||||
, open-watcom-bin ? null
|
, open-watcom-bin ? null
|
||||||
@ -14,6 +14,7 @@
|
|||||||
, enableHardening ? false
|
, enableHardening ? false
|
||||||
, headless ? false
|
, headless ? false
|
||||||
, enable32bitGuests ? true
|
, enable32bitGuests ? true
|
||||||
|
, enableWebService ? false
|
||||||
}:
|
}:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
@ -49,7 +50,8 @@ in stdenv.mkDerivation {
|
|||||||
++ optional pythonBindings python # Python is needed even when not building bindings
|
++ optional pythonBindings python # Python is needed even when not building bindings
|
||||||
++ optional pulseSupport libpulseaudio
|
++ optional pulseSupport libpulseaudio
|
||||||
++ optionals (headless) [ libXrandr libGL ]
|
++ 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" ];
|
hardeningDisable = [ "format" "fortify" "pic" "stackprotector" ];
|
||||||
|
|
||||||
@ -133,6 +135,10 @@ in stdenv.mkDerivation {
|
|||||||
PATH_QT5_X11_EXTRAS_INC := ${getDev qtx11extras}/include
|
PATH_QT5_X11_EXTRAS_INC := ${getDev qtx11extras}/include
|
||||||
TOOL_QT5_LRC := ${getDev qttools}/bin/lrelease
|
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
|
LOCAL_CONFIG
|
||||||
|
|
||||||
./configure \
|
./configure \
|
||||||
@ -142,6 +148,7 @@ in stdenv.mkDerivation {
|
|||||||
${optionalString (!pulseSupport) "--disable-pulse"} \
|
${optionalString (!pulseSupport) "--disable-pulse"} \
|
||||||
${optionalString (!enableHardening) "--disable-hardening"} \
|
${optionalString (!enableHardening) "--disable-hardening"} \
|
||||||
${optionalString (!enable32bitGuests) "--disable-vmmraw"} \
|
${optionalString (!enable32bitGuests) "--disable-vmmraw"} \
|
||||||
|
${optionalString (enableWebService) "--enable-webservice"} \
|
||||||
${optionalString (open-watcom-bin != null) "--with-ow-dir=${open-watcom-bin}"} \
|
${optionalString (open-watcom-bin != null) "--with-ow-dir=${open-watcom-bin}"} \
|
||||||
--disable-kmods
|
--disable-kmods
|
||||||
sed -e 's@PKG_CONFIG_PATH=.*@PKG_CONFIG_PATH=${libIDL}/lib/pkgconfig:${glib.dev}/lib/pkgconfig ${libIDL}/bin/libIDL-config-2@' \
|
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" {} +
|
-name src -o -exec cp -avt "$libexec" {} +
|
||||||
|
|
||||||
mkdir -p $out/bin
|
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"
|
echo "Linking $file to /bin"
|
||||||
test -x "$libexec/$file"
|
test -x "$libexec/$file"
|
||||||
ln -s "$libexec/$file" $out/bin/$file
|
ln -s "$libexec/$file" $out/bin/$file
|
||||||
|
Loading…
Reference in New Issue
Block a user