virtualbox: remove ? null from inputs, remove optional (), other minor cleanups

This commit is contained in:
Sandro Jäckel 2021-11-10 01:40:47 +01:00
parent 37bd69672d
commit df17da7729
No known key found for this signature in database
GPG Key ID: 3AF5A43A3EECC2E5

View File

@ -5,12 +5,12 @@
, alsa-lib, curl, libvpx, nettools, dbus, substituteAll, gsoap, zlib , 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
, makeself, perl , makeself, perl
, javaBindings ? true, jdk ? null # Almost doesn't affect closure size , javaBindings ? true, jdk # Almost doesn't affect closure size
, pythonBindings ? false, python3 ? null , pythonBindings ? false, python3
, extensionPack ? null, fakeroot ? null , extensionPack ? null, fakeroot
, pulseSupport ? config.pulseaudio or stdenv.isLinux, libpulseaudio ? null , pulseSupport ? config.pulseaudio or stdenv.isLinux, libpulseaudio
, enableHardening ? false , enableHardening ? false
, headless ? false , headless ? false
, enable32bitGuests ? true , enable32bitGuests ? true
@ -20,7 +20,6 @@
with lib; with lib;
let let
python = python3;
buildType = "release"; buildType = "release";
# Use maintainers/scripts/update.nix to update the version and all related hashes or # Use maintainers/scripts/update.nix to update the version and all related hashes or
# change the hashes in extpack.nix and guest-additions/default.nix as well manually. # change the hashes in extpack.nix and guest-additions/default.nix as well manually.
@ -42,23 +41,23 @@ in stdenv.mkDerivation {
# Wrap manually because we wrap just a small number of executables. # Wrap manually because we wrap just a small number of executables.
dontWrapQtApps = true; dontWrapQtApps = true;
buildInputs = buildInputs = [
[ acpica-tools dev86 libxslt libxml2 xorgproto libX11 libXext libXcursor libIDL acpica-tools dev86 libxslt libxml2 xorgproto libX11 libXext libXcursor libIDL
libcap glib lvm2 alsa-lib curl libvpx pam makeself perl libcap glib lvm2 alsa-lib curl libvpx pam makeself perl
libXmu libpng libopus python ] libXmu libpng libopus python3 ]
++ optional javaBindings jdk ++ optional javaBindings jdk
++ optional pythonBindings python # Python is needed even when not building bindings ++ optional pythonBindings python3 # 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 ]; ++ optionals enableWebService [ gsoap zlib ];
hardeningDisable = [ "format" "fortify" "pic" "stackprotector" ]; hardeningDisable = [ "format" "fortify" "pic" "stackprotector" ];
prePatch = '' prePatch = ''
set -x set -x
sed -e 's@MKISOFS --version@MKISOFS -version@' \ sed -e 's@MKISOFS --version@MKISOFS -version@' \
-e 's@PYTHONDIR=.*@PYTHONDIR=${if pythonBindings then python else ""}@' \ -e 's@PYTHONDIR=.*@PYTHONDIR=${lib.optionalString pythonBindings python3}@' \
-e 's@CXX_FLAGS="\(.*\)"@CXX_FLAGS="-std=c++11 \1"@' \ -e 's@CXX_FLAGS="\(.*\)"@CXX_FLAGS="-std=c++11 \1"@' \
${optionalString (!headless) '' ${optionalString (!headless) ''
-e 's@TOOLQT5BIN=.*@TOOLQT5BIN="${getDev qtbase}/bin"@' \ -e 's@TOOLQT5BIN=.*@TOOLQT5BIN="${getDev qtbase}/bin"@' \
@ -135,7 +134,7 @@ 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) '' ${optionalString enableWebService ''
# fix gsoap missing zlib include and produce errors with --as-needed # fix gsoap missing zlib include and produce errors with --as-needed
VBOX_GSOAP_CXX_LIBS := gsoapssl++ z VBOX_GSOAP_CXX_LIBS := gsoapssl++ z
''} ''}
@ -148,7 +147,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 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@' \
@ -175,7 +174,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"} ${optionalString (enableWebService) "vboxwebsrv"} 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
@ -183,14 +182,14 @@ in stdenv.mkDerivation {
${optionalString (extensionPack != null) '' ${optionalString (extensionPack != null) ''
mkdir -p "$share" mkdir -p "$share"
"${fakeroot}/bin/fakeroot" "${stdenv.shell}" <<EXTHELPER "${fakeroot}/bin/fakeroot" "${stdenv.shell}" <<EOF
"$libexec/VBoxExtPackHelperApp" install \ "$libexec/VBoxExtPackHelperApp" install \
--base-dir "$share/ExtensionPacks" \ --base-dir "$share/ExtensionPacks" \
--cert-dir "$share/ExtPackCertificates" \ --cert-dir "$share/ExtPackCertificates" \
--name "Oracle VM VirtualBox Extension Pack" \ --name "Oracle VM VirtualBox Extension Pack" \
--tarball "${extensionPack}" \ --tarball "${extensionPack}" \
--sha-256 "${extensionPack.outputHash}" --sha-256 "${extensionPack.outputHash}"
EXTHELPER EOF
''} ''}
${optionalString (!headless) '' ${optionalString (!headless) ''