From 5eaebff88194af0a0811cc107490604c74d25aef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gutyina=20Gerg=C5=91?= Date: Fri, 4 Apr 2025 11:29:11 +0200 Subject: [PATCH 1/4] vmware-workstation: make overridable --- .../by-name/vm/vmware-workstation/package.nix | 31 +++++++++---------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/pkgs/by-name/vm/vmware-workstation/package.nix b/pkgs/by-name/vm/vmware-workstation/package.nix index 2f8a60403087..79414bbd0381 100644 --- a/pkgs/by-name/vm/vmware-workstation/package.nix +++ b/pkgs/by-name/vm/vmware-workstation/package.nix @@ -33,7 +33,8 @@ unzip, }: -let +stdenv.mkDerivation (finalAttrs: { + pname = "vmware-workstation"; # base - versions version = "17.6.3"; build = "24583834"; @@ -45,13 +46,13 @@ let unlockerSrc = fetchFromGitHub { owner = "paolo-projects"; repo = "unlocker"; - rev = "${unlockerVersion}"; + rev = "${finalAttrs.unlockerVersion}"; sha256 = "sha256-JSEW1gqQuLGRkathlwZU/TnG6dL/xWKW4//SfE+kO0A="; }; vmware-unpack-env = buildFHSEnv { pname = "vmware-unpack-env"; - inherit version; + inherit (finalAttrs) version; targetPkgs = pkgs: [ zlib ]; }; @@ -62,10 +63,6 @@ let ln -s $out/lib/libreadline.so $out/lib/libreadline.so.6 ''; }; -in -stdenv.mkDerivation rec { - pname = "vmware-workstation"; - inherit version build; buildInputs = [ libxslt @@ -102,29 +99,29 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ python3 - vmware-unpack-env + finalAttrs.vmware-unpack-env autoPatchelfHook makeWrapper ] ++ lib.optionals enableInstaller [ bzip2 sqlite - readline70_compat63 + finalAttrs.readline70_compat63 ] ++ lib.optionals enableMacOSGuests [ unzip ]; src = requireFile { - name = "VMware-Workstation-Full-${version}-${build}.x86_64.bundle"; + name = "VMware-Workstation-Full-${finalAttrs.version}-${finalAttrs.build}.x86_64.bundle"; url = "https://support.broadcom.com/group/ecx/productdownloads?subfamily=VMware%20Workstation%20Pro&freeDownloads=true"; hash = "sha256-eVdZF3KN7UxtC4n0q2qBvpp3PADuto0dEqwNsSVHjuA="; }; unpackPhase = '' - ${vmware-unpack-env}/bin/vmware-unpack-env -c "sh ${src} --extract unpacked" + ${finalAttrs.vmware-unpack-env}/bin/vmware-unpack-env -c "sh ${finalAttrs.src} --extract unpacked" ''; postPatch = lib.optionalString enableMacOSGuests '' - cp -R "${unlockerSrc}" unlocker/ + cp -R "${finalAttrs.unlockerSrc}" unlocker/ substituteInPlace unlocker/unlocker.py --replace \ "/usr/lib/vmware/bin/" "$out/lib/vmware/bin" @@ -167,7 +164,7 @@ stdenv.mkDerivation rec { cp ${./vmware-installer-bootstrap} $out/etc/vmware-installer/bootstrap sed -i -e "s,@@INSTALLERDIR@@,$dest," $out/etc/vmware-installer/bootstrap sed -i -e "s,@@IVERSION@@,$vmware_installer_version," $out/etc/vmware-installer/bootstrap - sed -i -e "s,@@BUILD@@,${build}," $out/etc/vmware-installer/bootstrap + sed -i -e "s,@@BUILD@@,${finalAttrs.build}," $out/etc/vmware-installer/bootstrap # create database of vmware guest tools (avoids vmware fetching them later) mkdir -p $out/etc/vmware-installer/components @@ -181,7 +178,7 @@ stdenv.mkDerivation rec { component_version=$(cat unpacked/$component/manifest.xml | grep -oPm1 "(?<=)[^<]+") component_core_id=$([ "$component" == "vmware-installer" ] && echo "-1" || echo "1") type=$([ "$component" == "vmware-workstation" ] && echo "0" || echo "1") - sqlite3 "$database_filename" "INSERT INTO components(name,version,buildNumber,component_core_id,longName,description,type) VALUES('$component','$component_version',${build},$component_core_id,'$component','$component',$type);" + sqlite3 "$database_filename" "INSERT INTO components(name,version,buildNumber,component_core_id,longName,description,type) VALUES('$component','$component_version',${finalAttrs.build},$component_core_id,'$component','$component',$type);" mkdir -p $out/etc/vmware-installer/components/$component cp -r $folder/* $out/etc/vmware-installer/components/$component done @@ -195,8 +192,8 @@ stdenv.mkDerivation rec { ## VMware Config echo "Installing VMware Config" cp ${./vmware-config} $out/etc/vmware/config - sed -i -e "s,@@VERSION@@,${version}," $out/etc/vmware/config - sed -i -e "s,@@BUILD@@,${build}," $out/etc/vmware/config + sed -i -e "s,@@VERSION@@,${finalAttrs.version}," $out/etc/vmware/config + sed -i -e "s,@@BUILD@@,${finalAttrs.build}," $out/etc/vmware/config sed -i -e "s,@@PREFIXDIR@@,$out," $out/etc/vmware/config ## VMware VMX @@ -390,4 +387,4 @@ stdenv.mkDerivation rec { vifino ]; }; -} +}) From 09ff535e100a3681936602f98ab71d4b4783d3f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gutyina=20Gerg=C5=91?= Date: Fri, 4 Apr 2025 11:54:09 +0200 Subject: [PATCH 2/4] vmware-workstation: modernize --- .../by-name/vm/vmware-workstation/package.nix | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/pkgs/by-name/vm/vmware-workstation/package.nix b/pkgs/by-name/vm/vmware-workstation/package.nix index 79414bbd0381..3d3652bb1ec2 100644 --- a/pkgs/by-name/vm/vmware-workstation/package.nix +++ b/pkgs/by-name/vm/vmware-workstation/package.nix @@ -35,19 +35,14 @@ stdenv.mkDerivation (finalAttrs: { pname = "vmware-workstation"; - # base - versions version = "17.6.3"; build = "24583834"; - # macOS - versions - unlockerVersion = "3.0.5"; - - # macOS - Unlocker - unlockerSrc = fetchFromGitHub { + macOSUnlockerSrc = fetchFromGitHub { owner = "paolo-projects"; repo = "unlocker"; - rev = "${finalAttrs.unlockerVersion}"; - sha256 = "sha256-JSEW1gqQuLGRkathlwZU/TnG6dL/xWKW4//SfE+kO0A="; + tag = "3.0.5"; + hash = "sha256-JSEW1gqQuLGRkathlwZU/TnG6dL/xWKW4//SfE+kO0A="; }; vmware-unpack-env = buildFHSEnv { @@ -121,7 +116,7 @@ stdenv.mkDerivation (finalAttrs: { ''; postPatch = lib.optionalString enableMacOSGuests '' - cp -R "${finalAttrs.unlockerSrc}" unlocker/ + cp -R "${finalAttrs.macOSUnlockerSrc}" unlocker/ substituteInPlace unlocker/unlocker.py --replace \ "/usr/lib/vmware/bin/" "$out/lib/vmware/bin" @@ -375,13 +370,13 @@ stdenv.mkDerivation (finalAttrs: { runHook postInstall ''; - meta = with lib; { + meta = { description = "Industry standard desktop hypervisor for x86-64 architecture"; homepage = "https://www.vmware.com/products/workstation-pro.html"; - sourceProvenance = with sourceTypes; [ binaryNativeCode ]; - license = licenses.unfree; + sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; + license = lib.licenses.unfree; platforms = [ "x86_64-linux" ]; - maintainers = with maintainers; [ + maintainers = with lib.maintainers; [ cawilliamson deinferno vifino From 18ba6d1375eac5b2c268fd670a6eadeba60cdfc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gutyina=20Gerg=C5=91?= Date: Fri, 4 Apr 2025 11:57:09 +0200 Subject: [PATCH 3/4] vmware-workstation: update meta attrs --- pkgs/by-name/vm/vmware-workstation/package.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/vm/vmware-workstation/package.nix b/pkgs/by-name/vm/vmware-workstation/package.nix index 3d3652bb1ec2..15c33f2a521b 100644 --- a/pkgs/by-name/vm/vmware-workstation/package.nix +++ b/pkgs/by-name/vm/vmware-workstation/package.nix @@ -372,10 +372,11 @@ stdenv.mkDerivation (finalAttrs: { meta = { description = "Industry standard desktop hypervisor for x86-64 architecture"; - homepage = "https://www.vmware.com/products/workstation-pro.html"; + homepage = "https://www.vmware.com/products/desktop-hypervisor/workstation-and-fusion"; sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; license = lib.licenses.unfree; platforms = [ "x86_64-linux" ]; + mainProgram = "vmware"; maintainers = with lib.maintainers; [ cawilliamson deinferno From 5e3aa011a08a48b1232416bbd28ae208d221e9c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gutyina=20Gerg=C5=91?= Date: Fri, 4 Apr 2025 12:00:17 +0200 Subject: [PATCH 4/4] vmware-workstation: reorder attrs --- .../by-name/vm/vmware-workstation/package.nix | 78 +++++++++---------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/pkgs/by-name/vm/vmware-workstation/package.nix b/pkgs/by-name/vm/vmware-workstation/package.nix index 15c33f2a521b..71ee44c92531 100644 --- a/pkgs/by-name/vm/vmware-workstation/package.nix +++ b/pkgs/by-name/vm/vmware-workstation/package.nix @@ -38,11 +38,10 @@ stdenv.mkDerivation (finalAttrs: { version = "17.6.3"; build = "24583834"; - macOSUnlockerSrc = fetchFromGitHub { - owner = "paolo-projects"; - repo = "unlocker"; - tag = "3.0.5"; - hash = "sha256-JSEW1gqQuLGRkathlwZU/TnG6dL/xWKW4//SfE+kO0A="; + src = requireFile { + name = "VMware-Workstation-Full-${finalAttrs.version}-${finalAttrs.build}.x86_64.bundle"; + url = "https://support.broadcom.com/group/ecx/productdownloads?subfamily=VMware%20Workstation%20Pro&freeDownloads=true"; + hash = "sha256-eVdZF3KN7UxtC4n0q2qBvpp3PADuto0dEqwNsSVHjuA="; }; vmware-unpack-env = buildFHSEnv { @@ -51,6 +50,27 @@ stdenv.mkDerivation (finalAttrs: { targetPkgs = pkgs: [ zlib ]; }; + unpackPhase = '' + ${finalAttrs.vmware-unpack-env}/bin/vmware-unpack-env -c "sh ${finalAttrs.src} --extract unpacked" + ''; + + macOSUnlockerSrc = fetchFromGitHub { + owner = "paolo-projects"; + repo = "unlocker"; + tag = "3.0.5"; + hash = "sha256-JSEW1gqQuLGRkathlwZU/TnG6dL/xWKW4//SfE+kO0A="; + }; + + postPatch = lib.optionalString enableMacOSGuests '' + cp -R "${finalAttrs.macOSUnlockerSrc}" 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" + ''; + readline70_compat63 = symlinkJoin { name = "readline70_compat63"; paths = [ readline70 ]; @@ -59,6 +79,20 @@ stdenv.mkDerivation (finalAttrs: { ''; }; + nativeBuildInputs = + [ + python3 + finalAttrs.vmware-unpack-env + autoPatchelfHook + makeWrapper + ] + ++ lib.optionals enableInstaller [ + bzip2 + sqlite + finalAttrs.readline70_compat63 + ] + ++ lib.optionals enableMacOSGuests [ unzip ]; + buildInputs = [ libxslt libxml2 @@ -91,40 +125,6 @@ stdenv.mkDerivation (finalAttrs: { xorg.libXtst ]; - nativeBuildInputs = - [ - python3 - finalAttrs.vmware-unpack-env - autoPatchelfHook - makeWrapper - ] - ++ lib.optionals enableInstaller [ - bzip2 - sqlite - finalAttrs.readline70_compat63 - ] - ++ lib.optionals enableMacOSGuests [ unzip ]; - - src = requireFile { - name = "VMware-Workstation-Full-${finalAttrs.version}-${finalAttrs.build}.x86_64.bundle"; - url = "https://support.broadcom.com/group/ecx/productdownloads?subfamily=VMware%20Workstation%20Pro&freeDownloads=true"; - hash = "sha256-eVdZF3KN7UxtC4n0q2qBvpp3PADuto0dEqwNsSVHjuA="; - }; - - unpackPhase = '' - ${finalAttrs.vmware-unpack-env}/bin/vmware-unpack-env -c "sh ${finalAttrs.src} --extract unpacked" - ''; - - postPatch = lib.optionalString enableMacOSGuests '' - cp -R "${finalAttrs.macOSUnlockerSrc}" 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 = '' runHook preInstall