From df17da77298f13a3a92366056252ec703b6a9b35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Wed, 10 Nov 2021 01:40:47 +0100 Subject: [PATCH] virtualbox: remove ? null from inputs, remove optional (), other minor cleanups --- .../virtualization/virtualbox/default.nix | 37 +++++++++---------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/pkgs/applications/virtualization/virtualbox/default.nix b/pkgs/applications/virtualization/virtualbox/default.nix index 0dcebb71cc5f..128753f26433 100644 --- a/pkgs/applications/virtualization/virtualbox/default.nix +++ b/pkgs/applications/virtualization/virtualbox/default.nix @@ -5,12 +5,12 @@ , 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 +, open-watcom-bin , makeself, perl -, javaBindings ? true, jdk ? null # Almost doesn't affect closure size -, pythonBindings ? false, python3 ? null -, extensionPack ? null, fakeroot ? null -, pulseSupport ? config.pulseaudio or stdenv.isLinux, libpulseaudio ? null +, javaBindings ? true, jdk # Almost doesn't affect closure size +, pythonBindings ? false, python3 +, extensionPack ? null, fakeroot +, pulseSupport ? config.pulseaudio or stdenv.isLinux, libpulseaudio , enableHardening ? false , headless ? false , enable32bitGuests ? true @@ -20,7 +20,6 @@ with lib; let - python = python3; buildType = "release"; # 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. @@ -42,23 +41,23 @@ in stdenv.mkDerivation { # Wrap manually because we wrap just a small number of executables. dontWrapQtApps = true; - buildInputs = - [ acpica-tools dev86 libxslt libxml2 xorgproto libX11 libXext libXcursor libIDL - libcap glib lvm2 alsa-lib curl libvpx pam makeself perl - libXmu libpng libopus python ] + buildInputs = [ + acpica-tools dev86 libxslt libxml2 xorgproto libX11 libXext libXcursor libIDL + libcap glib lvm2 alsa-lib curl libvpx pam makeself perl + libXmu libpng libopus python3 ] ++ 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 - ++ optionals (headless) [ libXrandr libGL ] + ++ optionals headless [ libXrandr libGL ] ++ optionals (!headless) [ qtbase qtx11extras libXinerama SDL ] - ++ optionals (enableWebService) [ gsoap zlib ]; + ++ optionals enableWebService [ gsoap zlib ]; hardeningDisable = [ "format" "fortify" "pic" "stackprotector" ]; prePatch = '' set -x 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"@' \ ${optionalString (!headless) '' -e 's@TOOLQT5BIN=.*@TOOLQT5BIN="${getDev qtbase}/bin"@' \ @@ -135,7 +134,7 @@ in stdenv.mkDerivation { PATH_QT5_X11_EXTRAS_INC := ${getDev qtx11extras}/include TOOL_QT5_LRC := ${getDev qttools}/bin/lrelease ''} - ${optionalString (enableWebService) '' + ${optionalString enableWebService '' # fix gsoap missing zlib include and produce errors with --as-needed VBOX_GSOAP_CXX_LIBS := gsoapssl++ z ''} @@ -148,7 +147,7 @@ in stdenv.mkDerivation { ${optionalString (!pulseSupport) "--disable-pulse"} \ ${optionalString (!enableHardening) "--disable-hardening"} \ ${optionalString (!enable32bitGuests) "--disable-vmmraw"} \ - ${optionalString (enableWebService) "--enable-webservice"} \ + ${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@' \ @@ -175,7 +174,7 @@ in stdenv.mkDerivation { -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 + 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 @@ -183,14 +182,14 @@ in stdenv.mkDerivation { ${optionalString (extensionPack != null) '' mkdir -p "$share" - "${fakeroot}/bin/fakeroot" "${stdenv.shell}" <