30 , enableInstaller ? false, bzip2, sqlite
31 , enableMacOSGuests ? false, fetchFromGitHub, unzip
32 , enableGuestTools ? true,
39 baseUrl = "https://softwareupdate.vmware.com/cds/vmw-desktop/ws/${version}/${build}/linux";
42 toolsVersion = "12.4.0";
43 toolsBuild = "23259341";
46 fusionVersion = "13.5.2";
47 fusionBuild = "23775688";
48 unlockerVersion = "3.0.5";
52 fetchComponent = (system: hash: fetchzip {
54 url = "${baseUrl}/packages/vmware-tools-${system}-${toolsVersion}-${toolsBuild}.x86_64.component.tar";
56 } + "/vmware-tools-${system}-${toolsVersion}-${toolsBuild}.x86_64.component");
57 in lib.mapAttrsToList fetchComponent {
58 linux = "sha256-vT08mR6cCXZjiQgb9jy+MaqYzS0hFbNUM7xGAHIJ8Ao=";
59 linuxPreGlibc25 = "sha256-BodN1lxuhxyLlxIQSlVhGKItJ10VPlti/sEyxcRF2SA=";
60 netware = "sha256-o/S4wAYLR782Fn20fTQ871+rzsa1twnAxb9laV16XIk=";
61 solaris = "sha256-3LdFoI4TD5zxlohDGR3DRGbF6jwDZAoSMEpHWU4vSGU=";
62 winPre2k = "sha256-+QcvWfY3aCDxUwAfSuj7Wf9sxIO+ztWBrRolMim8Dfw=";
63 winPreVista = "sha256-3NgO/GdRFTpKNo45TMet0msjzxduuoF4nVLtnOUTHUA=";
64 windows = "sha256-2F7UPjNvtibmWAJxpB8IOnol12aMOGMy+403WeCTXw8=";
68 darwinIsoSrc = fetchzip {
69 url = "https://softwareupdate.vmware.com/cds/vmw-desktop/fusion/${fusionVersion}/${fusionBuild}/universal/core/com.vmware.fusion.zip.tar";
70 sha256 = "sha256-DDLRWAVRI3ZeXV5bUXWwput9mEC1qsJUsjojI0CJYMI=";
72 } + "/com.vmware.fusion.zip";
75 unlockerSrc = fetchFromGitHub {
76 owner = "paolo-projects";
78 rev = "${unlockerVersion}";
79 sha256 = "sha256-JSEW1gqQuLGRkathlwZU/TnG6dL/xWKW4//SfE+kO0A=";
82 vmware-unpack-env = buildFHSEnv rec {
83 name = "vmware-unpack-env";
84 targetPkgs = pkgs: [ zlib ];
87 readline70_compat63 = symlinkJoin {
88 name = "readline70_compat63";
89 paths = [ readline70 ];
91 ln -s $out/lib/libreadline.so $out/lib/libreadline.so.6
95 stdenv.mkDerivation rec {
96 pname = "vmware-workstation";
97 inherit version build;
120 nativeBuildInputs = [ python3 vmware-unpack-env autoPatchelfHook makeWrapper ]
121 ++ lib.optionals enableInstaller [ bzip2 sqlite readline70_compat63 ]
122 ++ lib.optionals enableMacOSGuests [ unzip ];
125 url = "${baseUrl}/core/VMware-Workstation-${version}-${build}.x86_64.bundle.tar";
126 sha256 = "sha256-5PZZpXN/V687TXjqeTm8MEays4/QTf02jVfdpi9C7GI=";
128 } + "/VMware-Workstation-${version}-${build}.x86_64.bundle";
131 guestTools = lib.optionalString enableGuestTools (lib.concatMapStringsSep " " (src: "--install-component ${src}") guestToolsSrc);
134 ${vmware-unpack-env}/bin/vmware-unpack-env -c "sh ${src} ${guestTools} --extract unpacked"
136 ${lib.optionalString enableMacOSGuests ''
138 unzip "${darwinIsoSrc}" \
139 "payload/VMware Fusion.app/Contents/Library/isoimages/x86_x64/darwin.iso" \
140 "payload/VMware Fusion.app/Contents/Library/isoimages/x86_x64/darwinPre15.iso" \
145 postPatch = lib.optionalString enableMacOSGuests ''
146 cp -R "${unlockerSrc}" unlocker/
148 substituteInPlace unlocker/unlocker.py --replace \
149 "/usr/lib/vmware/bin/" "$out/lib/vmware/bin"
151 substituteInPlace unlocker/unlocker.py --replace \
152 "/usr/lib/vmware/lib/libvmwarebase.so/libvmwarebase.so" "$out/lib/vmware/lib/libvmwarebase.so/libvmwarebase.so"
165 #### Replicate vmware-installer's order but VMX first because of appLoader
166 ${lib.optionalString enableInstaller ''
168 echo "Installing VMware Installer"
169 unpacked="unpacked/vmware-installer"
170 vmware_installer_version=$(cat "unpacked/vmware-installer/manifest.xml" | grep -oPm1 "(?<=<version>)[^<]+")
171 dest="$out/lib/vmware-installer/$vmware_installer_version"
174 cp -r $unpacked/vmis* $dest/
175 cp -r $unpacked/sopython $dest/
176 cp -r $unpacked/python $dest/
177 cp -r $unpacked/cdsHelper $dest/
178 cp -r $unpacked/vmware* $dest/
179 cp -r $unpacked/bin $dest/
180 cp -r $unpacked/lib $dest/
182 chmod +x $dest/vmis-launcher $dest/sopython/* $dest/python/init.sh $dest/vmware-*
183 ln -s $dest/vmware-installer $out/bin/vmware-installer
185 mkdir -p $out/etc/vmware-installer
186 cp ${./vmware-installer-bootstrap} $out/etc/vmware-installer/bootstrap
187 sed -i -e "s,@@INSTALLERDIR@@,$dest," $out/etc/vmware-installer/bootstrap
188 sed -i -e "s,@@IVERSION@@,$vmware_installer_version," $out/etc/vmware-installer/bootstrap
189 sed -i -e "s,@@BUILD@@,${build}," $out/etc/vmware-installer/bootstrap
191 # create database of vmware guest tools (avoids vmware fetching them later)
192 mkdir -p $out/etc/vmware-installer/components
193 database_filename=$out/etc/vmware-installer/database
194 touch $database_filename
195 sqlite3 "$database_filename" "CREATE TABLE settings(key VARCHAR PRIMARY KEY, value VARCHAR NOT NULL, component_name VARCHAR NOT NULL);"
196 sqlite3 "$database_filename" "INSERT INTO settings(key,value,component_name) VALUES('db.schemaVersion','2','vmware-installer');"
197 sqlite3 "$database_filename" "CREATE TABLE components(id INTEGER PRIMARY KEY, name VARCHAR NOT NULL, version VARCHAR NOT NULL, buildNumber INTEGER NOT NULL, component_core_id INTEGER NOT NULL, longName VARCHAR NOT NULL, description VARCHAR, type INTEGER NOT NULL);"
198 for folder in unpacked/**/.installer ; do
199 component="$(basename $(dirname $folder))"
200 component_version=$(cat unpacked/$component/manifest.xml | grep -oPm1 "(?<=<version>)[^<]+")
201 component_core_id=$([ "$component" == "vmware-installer" ] && echo "-1" || echo "1")
202 type=$([ "$component" == "vmware-workstation" ] && echo "0" || echo "1")
203 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);"
204 mkdir -p $out/etc/vmware-installer/components/$component
205 cp -r $folder/* $out/etc/vmware-installer/components/$component
210 echo "Installing VMware Bootstrap"
211 cp ${./vmware-bootstrap} $out/etc/vmware/bootstrap
212 sed -i -e "s,@@PREFIXDIR@@,$out," $out/etc/vmware/bootstrap
215 echo "Installing VMware Config"
216 cp ${./vmware-config} $out/etc/vmware/config
217 sed -i -e "s,@@VERSION@@,${version}," $out/etc/vmware/config
218 sed -i -e "s,@@BUILD@@,${build}," $out/etc/vmware/config
219 sed -i -e "s,@@PREFIXDIR@@,$out," $out/etc/vmware/config
222 echo "Installing VMware VMX"
223 unpacked="unpacked/vmware-vmx"
224 cp -r $unpacked/bin/* $out/bin/
225 cp -r $unpacked/etc/modprobe.d $out/etc/
226 cp -r $unpacked/etc/init.d/* $out/etc/init.d/
227 cp -r $unpacked/roms $out/lib/vmware/
228 cp -r $unpacked/sbin/* $out/bin/
230 cp -r $unpacked/lib/libconf $out/lib/vmware/
231 rm $out/lib/vmware/libconf/etc/fonts/fonts.conf
233 cp -r $unpacked/lib/bin $out/lib/vmware/
234 cp -r $unpacked/lib/lib $out/lib/vmware/
235 cp -r $unpacked/lib/scripts $out/lib/vmware/
236 cp -r $unpacked/lib/icu $out/lib/vmware/
237 cp -r $unpacked/lib/share $out/lib/vmware/
238 cp -r $unpacked/lib/modules $out/lib/vmware/
239 cp -r $unpacked/lib/include $out/lib/vmware/
241 cp -r $unpacked/extra/checkvm $out/bin/
242 cp -r $unpacked/extra/modules.xml $out/lib/vmware/modules/
244 ln -s $out/lib/vmware/bin/appLoader $out/lib/vmware/bin/vmware-vmblock-fuse
245 ln -s $out/lib/vmware/icu $out/etc/vmware/icu
247 # Replace vmware-modconfig with simple error dialog
248 cp ${./vmware-modconfig} $out/bin/vmware-modconfig
249 sed -i -e "s,ETCDIR=/etc/vmware,ETCDIR=$out/etc/vmware," $out/bin/vmware-modconfig
251 # Patch dynamic libs in
252 for binary in "mksSandbox" "mksSandbox-debug" "mksSandbox-stats" "vmware-vmx" "vmware-vmx-debug" "vmware-vmx-stats"
255 --add-needed ${libaio}/lib/libaio.so.1 \
256 --add-needed ${vulkan-loader}/lib/libvulkan.so.1 \
257 --add-needed ${alsa-lib}/lib/libasound.so \
258 --add-needed ${libpulseaudio}/lib/libpulse.so.0 \
259 --add-needed ${libGL}/lib/libEGL.so.1 \
260 --add-needed ${numactl}/lib/libnuma.so.1 \
261 --add-needed ${libX11}/lib/libX11.so.6 \
262 --add-needed ${libXi}/lib/libXi.so.6 \
263 --add-needed ${libGL}/lib/libGL.so.1 \
264 $out/lib/vmware/bin/$binary
267 ## VMware USB Arbitrator
268 echo "Installing VMware USB Arbitrator"
269 unpacked="unpacked/vmware-usbarbitrator"
270 cp -r $unpacked/etc/init.d/* $out/etc/init.d/
271 cp -r $unpacked/bin/* $out/bin/
272 ln -s $out/lib/vmware/bin/appLoader $out/lib/vmware/bin/vmware-usbarbitrator
274 ## VMware Player Setup
275 echo "Installing VMware Player Setup"
276 unpacked="unpacked/vmware-player-setup"
277 mkdir -p $out/lib/vmware/setup
278 cp $unpacked/vmware-config $out/lib/vmware/setup/
280 ## VMware Network Editor
281 echo "Installing VMware Network Editor"
282 unpacked="unpacked/vmware-network-editor"
283 cp -r $unpacked/lib $out/lib/vmware/
285 mkdir -p $out/lib/vmware/isoimages/
287 ${lib.optionalString enableGuestTools ''
288 echo "Installing VMware Tools"
289 cp unpacked/vmware-tools-linux/linux.iso \
290 unpacked/vmware-tools-linuxPreGlibc25/linuxPreGlibc25.iso \
291 unpacked/vmware-tools-netware/netware.iso \
292 unpacked/vmware-tools-solaris/solaris.iso \
293 unpacked/vmware-tools-winPre2k/winPre2k.iso \
294 unpacked/vmware-tools-winPreVista/winPreVista.iso \
295 unpacked/vmware-tools-windows/windows.iso \
296 $out/lib/vmware/isoimages/
299 ${lib.optionalString enableMacOSGuests ''
300 echo "Installing VMWare Tools for MacOS"
302 "fusion/payload/VMware Fusion.app/Contents/Library/isoimages/x86_x64/darwin.iso" \
303 "fusion/payload/VMware Fusion.app/Contents/Library/isoimages/x86_x64/darwinPre15.iso" \
304 $out/lib/vmware/isoimages/
307 ## VMware Player Application
308 echo "Installing VMware Player Application"
309 unpacked="unpacked/vmware-player-app"
310 cp -r $unpacked/lib/* $out/lib/vmware/
311 cp -r $unpacked/share/* $out/share/
312 cp -r $unpacked/bin/* $out/bin/
313 cp -r $unpacked/doc/* $out/share/doc/ # Licences
315 for target in "vmplayer" "vmware-enter-serial" "vmware-setup-helper" "licenseTool" "vmware-mount" "vmware-fuseUI" "vmware-app-control" "vmware-zenity"
317 ln -s $out/lib/vmware/bin/appLoader $out/lib/vmware/bin/$target
320 ln -s $out/lib/vmware/bin/vmware-mount $out/bin/vmware-mount
321 ln -s $out/lib/vmware/bin/vmware-fuseUI $out/bin/vmware-fuseUI
322 ln -s $out/lib/vmware/bin/vmrest $out/bin/vmrest
325 sed -i -e "s,ETCDIR=/etc/vmware,ETCDIR=$out/etc/vmware," $out/bin/vmplayer
326 sed -i -e "s,/sbin/modprobe,${kmod}/bin/modprobe," $out/bin/vmplayer
327 sed -i -e "s,@@BINARY@@,$out/bin/vmplayer," $out/share/applications/vmware-player.desktop
329 ## VMware OVF Tool component
330 echo "Installing VMware OVF Tool for Linux"
331 unpacked="unpacked/vmware-ovftool"
332 mkdir -p $out/lib/vmware-ovftool/
334 cp -r $unpacked/* $out/lib/vmware-ovftool/
335 chmod 755 $out/lib/vmware-ovftool/ovftool*
336 makeWrapper "$out/lib/vmware-ovftool/ovftool.bin" "$out/bin/ovftool"
338 ## VMware Network Editor User Interface
339 echo "Installing VMware Network Editor User Interface"
340 unpacked="unpacked/vmware-network-editor-ui"
341 cp -r $unpacked/share/* $out/share/
343 ln -s $out/lib/vmware/bin/appLoader $out/lib/vmware/bin/vmware-netcfg
344 ln -s $out/lib/vmware/bin/vmware-netcfg $out/bin/vmware-netcfg
346 # Patch network editor ui
348 sed -i -e "s,@@BINARY@@,$out/bin/vmware-netcfg," $out/share/applications/vmware-netcfg.desktop
350 ## VMware VIX Core Library
351 echo "Installing VMware VIX Core Library"
352 unpacked="unpacked/vmware-vix-core"
353 mkdir -p $out/lib/vmware-vix
354 cp -r $unpacked/lib/* $out/lib/vmware-vix/
355 cp -r $unpacked/bin/* $out/bin/
356 cp $unpacked/*.txt $out/lib/vmware-vix/
358 mkdir -p $out/share/doc/vmware-vix/
359 cp -r $unpacked/doc/* $out/share/doc/vmware-vix/
361 mkdir -p $out/include/
362 cp -r $unpacked/include/* $out/include/
364 ## VMware VIX Workstation-17.0.0 Library
365 echo "Installing VMware VIX Workstation-17.0.0 Library"
366 unpacked="unpacked/vmware-vix-lib-Workstation1700"
367 cp -r $unpacked/lib/* $out/lib/vmware-vix/
369 ## VMware VProbes component for Linux
370 echo "Installing VMware VProbes component for Linux"
371 unpacked="unpacked/vmware-vprobe"
372 cp -r $unpacked/bin/* $out/bin/
373 cp -r $unpacked/lib/* $out/lib/vmware/
375 ## VMware Workstation
376 echo "Installing VMware Workstation"
377 unpacked="unpacked/vmware-workstation"
378 cp -r $unpacked/bin/* $out/bin/
379 cp -r $unpacked/lib/* $out/lib/vmware/
380 cp -r $unpacked/share/* $out/share/
381 cp -r $unpacked/man $out/share/
382 cp -r $unpacked/doc $out/share/
384 ln -s $out/lib/vmware/bin/appLoader $out/lib/vmware/bin/vmware
385 ln -s $out/lib/vmware/bin/appLoader $out/lib/vmware/bin/vmware-tray
386 ln -s $out/lib/vmware/bin/appLoader $out/lib/vmware/bin/vmware-vprobe
389 sed -i -e "s,ETCDIR=/etc/vmware,ETCDIR=$out/etc/vmware,g" $out/bin/vmware
390 sed -i -e "s,/sbin/modprobe,${kmod}/bin/modprobe,g" $out/bin/vmware
391 sed -i -e "s,@@BINARY@@,$out/bin/vmware," $out/share/applications/vmware-workstation.desktop
393 chmod +x $out/bin/* $out/lib/vmware/bin/* $out/lib/vmware/setup/*
395 # Hardcoded pkexec hack
396 for lib in "lib/vmware/lib/libvmware-mount.so/libvmware-mount.so" "lib/vmware/lib/libvmwareui.so/libvmwareui.so" "lib/vmware/lib/libvmware-fuseUI.so/libvmware-fuseUI.so"
398 sed -i -e "s,/usr/local/sbin,/run/vmware/bin," "$out/$lib"
401 ${lib.optionalString enableMacOSGuests ''
402 echo "Running VMWare Unlocker to enable macOS Guests"
403 python3 unlocker/unlocker.py
407 wrapProgram $out/lib/vmware/bin/vmware-vmx
408 rm $out/lib/vmware/bin/vmware-vmx
409 ln -s /run/wrappers/bin/vmware-vmx $out/lib/vmware/bin/vmware-vmx
415 description = "Industry standard desktop hypervisor for x86-64 architecture";
416 homepage = "https://www.vmware.com/products/workstation-pro.html";
417 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
418 license = licenses.unfree;
419 platforms = [ "x86_64-linux" ];
420 maintainers = with maintainers; [ cawilliamson deinferno vifino ];