From e23dc698987b5f8b0034d5033127513d5d026452 Mon Sep 17 00:00:00 2001 From: "Christopher A. Williamson" Date: Thu, 24 Nov 2022 17:56:14 +0000 Subject: [PATCH] vmware-workstation: 16.2.3 -> 17.0.0 and support macOS guests --- .../vmware-workstation/default.nix | 78 ++++++++++++++++--- pkgs/os-specific/linux/vmware/default.nix | 6 +- 2 files changed, 69 insertions(+), 15 deletions(-) diff --git a/pkgs/applications/virtualization/vmware-workstation/default.nix b/pkgs/applications/virtualization/vmware-workstation/default.nix index 0863eae3bb04..6bcd15dc52ff 100755 --- a/pkgs/applications/virtualization/vmware-workstation/default.nix +++ b/pkgs/applications/virtualization/vmware-workstation/default.nix @@ -26,13 +26,29 @@ , makeWrapper , sqlite , enableInstaller ? false +, enableMacOSGuests ? false, fetchFromGitHub, gnutar, unzip }: let - vmware-unpack-env = buildFHSUserEnv rec { - name = "vmware-unpack-env"; - targetPkgs = pkgs: [ zlib ]; + # macOS - versions + fusionVersion = "13.0.0"; + fusionBuild = "20802013"; + unlockerVersion = "3.0.4"; + + # macOS - ISOs + darwinIsoSrc = fetchurl { + url = "https://softwareupdate.vmware.com/cds/vmw-desktop/fusion/${fusionVersion}/${fusionBuild}/x86/core/com.vmware.fusion.zip.tar"; + sha256 = "sha256-cSboek+nhkVj8rjdic6yzWQfjXiiLlch6gBWn73BzRU="; }; + + # macOS - Unlocker + unlockerSrc = fetchFromGitHub { + owner = "paolo-projects"; + repo = "unlocker"; + rev = "${unlockerVersion}"; + sha256 = "sha256-kpvrRiiygfjQni8z+ju9mPBVqy2gs08Wj4cHxE9eorQ="; + }; + gdbm3 = gdbm.overrideAttrs (old: rec { version = "1.8.3"; @@ -46,11 +62,16 @@ let cp .libs/libgdbm*.so* $out/lib/ ''; }); + + vmware-unpack-env = buildFHSUserEnv rec { + name = "vmware-unpack-env"; + targetPkgs = pkgs: [ zlib ]; + }; in stdenv.mkDerivation rec { pname = "vmware-workstation"; - version = "16.2.3"; - build = "19376536"; + version = "17.0.0"; + build = "20800274"; buildInputs = [ libxslt @@ -73,15 +94,35 @@ stdenv.mkDerivation rec { ]; nativeBuildInputs = [ python3 vmware-unpack-env autoPatchelfHook makeWrapper ] - ++ lib.optionals enableInstaller [ sqlite bzip2 ]; + ++ lib.optionals enableInstaller [ sqlite bzip2 ] + ++ lib.optionals enableMacOSGuests [ gnutar unzip ]; src = fetchurl { - url = "https://download3.vmware.com/software/WKST-1623-LX-New/VMware-Workstation-Full-${version}-${build}.x86_64.bundle"; - sha256 = "sha256-+JE1KnRfawcaBannIyEr1TNZTF7YXRYYaFMVq0/erbM="; + url = "https://download3.vmware.com/software/WKST-1700-LX/VMware-Workstation-Full-${version}-${build}.x86_64.bundle"; + sha256 = "sha256-kBTocGb1tg5i+dvWmOaPfPUHxrWcX8/obeKqRGR+mRA="; }; unpackPhase = '' ${vmware-unpack-env}/bin/vmware-unpack-env -c "sh ${src} --extract unpacked" + + ${lib.optionalString enableMacOSGuests '' + mkdir -p fusion/ + tar -xvpf "${darwinIsoSrc}" -C fusion/ + unzip "fusion/com.vmware.fusion.zip" \ + "payload/VMware Fusion.app/Contents/Library/isoimages/x86_x64/darwin.iso" \ + "payload/VMware Fusion.app/Contents/Library/isoimages/x86_x64/darwinPre15.iso" \ + -d fusion/ + ''} + ''; + + patchPhase = lib.optionalString enableMacOSGuests '' + cp -R "${unlockerSrc}" unlocker/ + + substituteInPlace unlocker/unlocker.py --replace \ + "/usr/lib/vmware/bin/" "$out/lib/vmware/bin" + + substituteInPlace unlocker/unlocker.py --replace \ + "/usr/lib/vmware/lib/libvmwarebase.so/libvmwarebase.so" "$out/lib/vmware/lib/libvmwarebase.so/libvmwarebase.so" ''; installPhase = '' @@ -226,6 +267,14 @@ stdenv.mkDerivation rec { unpacked/vmware-tools-solaris/solaris.iso \ $out/lib/vmware/isoimages/ + ${lib.optionalString enableMacOSGuests '' + echo "Installing VMWare Tools for MacOS" + cp -v \ + "fusion/payload/VMware Fusion.app/Contents/Library/isoimages/x86_x64/darwin.iso" \ + "fusion/payload/VMware Fusion.app/Contents/Library/isoimages/x86_x64/darwinPre15.iso" \ + $out/lib/vmware/isoimages/ + ''} + ## VMware Player Application echo "Installing VMware Player Application" unpacked="unpacked/vmware-player-app" @@ -290,9 +339,9 @@ stdenv.mkDerivation rec { mkdir -p $out/include/ cp -r $unpacked/include/* $out/include/ - ## VMware VIX Workstation-16.0.0 Library - echo "Installing VMware VIX Workstation-16.0.0 Library" - unpacked="unpacked/vmware-vix-lib-Workstation1600" + ## VMware VIX Workstation-17.0.0 Library + echo "Installing VMware VIX Workstation-17.0.0 Library" + unpacked="unpacked/vmware-vix-lib-Workstation1700" cp -r $unpacked/lib/* $out/lib/vmware-vix/ ## VMware VProbes component for Linux @@ -327,6 +376,11 @@ stdenv.mkDerivation rec { sed -i -e "s,/usr/local/sbin,/run/vmware/bin," "$out/$lib" done + ${lib.optionalString enableMacOSGuests '' + echo "Running VMWare Unlocker to enable macOS Guests" + python3 unlocker/unlocker.py + ''} + # SUID hack wrapProgram $out/lib/vmware/bin/vmware-vmx rm $out/lib/vmware/bin/vmware-vmx @@ -339,6 +393,6 @@ stdenv.mkDerivation rec { sourceProvenance = with sourceTypes; [ binaryNativeCode ]; license = licenses.unfree; platforms = [ "x86_64-linux" ]; - maintainers = with maintainers; [ deinferno ]; + maintainers = with maintainers; [ cawilliamson deinferno ]; }; } diff --git a/pkgs/os-specific/linux/vmware/default.nix b/pkgs/os-specific/linux/vmware/default.nix index ecc43bf3f3a9..162ae766a845 100644 --- a/pkgs/os-specific/linux/vmware/default.nix +++ b/pkgs/os-specific/linux/vmware/default.nix @@ -7,8 +7,8 @@ stdenv.mkDerivation rec { src = fetchFromGitHub { owner = "mkubecek"; repo = "vmware-host-modules"; - rev = "w${vmware-workstation.version}-k5.18"; - sha256 = "sha256-sAeCjaSrBXGP5szfCY5CpMrGwzCw4aM67EN+YfA3AWA="; + rev = "w${vmware-workstation.version}"; + sha256 = "sha256-EHMiSmljpUjYuZH6r/0Vk5OVGeyQyNngy0AVJO/48a0="; }; hardeningDisable = [ "pic" ]; @@ -41,7 +41,7 @@ stdenv.mkDerivation rec { homepage = "https://github.com/mkubecek/vmware-host-modules"; license = licenses.gpl2Only; platforms = [ "x86_64-linux" ]; - broken = (kernel.kernelOlder "5.5" && kernel.isHardened) || kernel.kernelAtLeast "5.19"; + broken = (kernel.kernelOlder "5.5" && kernel.isHardened); maintainers = with maintainers; [ deinferno ]; }; }