nixpkgs icon indicating copy to clipboard operation
nixpkgs copied to clipboard

Build failure: vmware-workstation

Open gepbird opened this issue 1 year ago • 11 comments

Nixpkgs version

  • Unstable (25.05)

Steps to reproduce

  1. NIXPKGS_ALLOW_UNFREE=1 nix build github:NixOS/nixpkgs/5c72fd684249c99b173fbc33ef82c460f414f60b#vmware-workstation --impure

Can Hydra reproduce this build failure?

No, Hydra cannot reproduce this build failure.

Link to Hydra build job

No response

Relevant log output

trying https://softwareupdate.vmware.com/cds/vmw-desktop/ws/17.6.1/24319023/linux/core/VMware-Workstation-17.6.1-24319023.x86_64.bundle.tar
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   167  100   167    0     0   2750      0 --:--:-- --:--:-- --:--:--  2783
100  354k    0  354k    0     0  1056k      0 --:--:-- --:--:-- --:--:-- 1056k
unpacking source archive /build/VMware-Workstation-17.6.1-24319023.x86_64.bundle.tar
tar: This does not look like a tar archive
tar: Skipping to next header
tar: Exiting with failure status due to previous errors
do not know how to unpack source archive /build/VMware-Workstation-17.6.1-24319023.x86_64.bundle.tar

Additional context

Related: https://github.com/NixOS/nixpkgs/issues/310121

System metadata

  • system: "x86_64-linux"
  • host os: Linux 6.13.7-zen1, NixOS, 25.05 (Warbler), 25.05.20250315.c80f6a7
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Lix, like Nix) 2.91.1 System type: x86_64-linux Additional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux Features: gc, signed-caches System configuration file: /etc/nix/nix.conf User configuration files: /home/gep/.config/nix/nix.conf:/etc/xdg/nix/nix.conf:/home/gep/.nix-profile/etc/xdg/nix/nix.conf:/nix/profile/etc/xdg/nix/nix.conf:/home/gep/.local/state/nix/profile/etc/xdg/nix/nix.conf:/etc/profiles/per-user/gep/etc/xdg/nix/nix.conf:/nix/var/nix/profiles/default/etc/xdg/nix/nix.conf:/run/current-system/sw/etc/xdg/nix/nix.conf Store directory: /nix/store State directory: /nix/var/nix Data directory: /nix/store/riqr33jgc60nsk8w2d0blq17y8skp0yn-lix-2.91.1/share
  • nixpkgs: /nix/store/alzxn3hjisc84hrlv44x6hni48crww26-source

Notify maintainers

@cawilliamson @deinferno @vifino


Note for maintainers: Please tag this issue in your pull request description. (i.e. Resolves #ISSUE.)

I assert that this issue is relevant for Nixpkgs

Is this issue important to you?

Add a :+1: reaction to issues you find important.

gepbird avatar Mar 24 '25 20:03 gepbird

I'm pretty sure it downloaded an HTML page instead of the tar archive, since the download URL is no longer valid.

SigmaSquadron avatar Mar 24 '25 20:03 SigmaSquadron

The new download URLs also seem to be behind authentication gates, so this will need a requireFile.

SigmaSquadron avatar Mar 24 '25 20:03 SigmaSquadron

Yes the download url now returns a 301 redirecting to the broadcom support site (location: https://support.broadcom.com):

curl -v https://softwareupdate.vmware.com/cds/vmw-desktop/ws/17.6.1/24319023/linux/core/VMware-Workstation-17.6.1-24319023.x86_64.bundle.tar
* Host softwareupdate.vmware.com:443 was resolved.
* IPv6: 2a06:98c1:58::a5, 2606:4700:7::a5
* IPv4: 172.66.0.165, 162.159.140.167
*   Trying [2a06:98c1:58::a5]:443...
* Immediate connect fail for 2a06:98c1:58::a5: Network is unreachable
*   Trying [2606:4700:7::a5]:443...
* Immediate connect fail for 2606:4700:7::a5: Network is unreachable
*   Trying 172.66.0.165:443...
* ALPN: curl offers h2,http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384 / x25519 / RSASSA-PSS
* ALPN: server accepted h2
* Server certificate:
*  subject: C=US; ST=California; L=Palo Alto; O=Broadcom Inc.; CN=softwareupdate.vmware.com
*  start date: May 27 00:00:00 2024 GMT
*  expire date: May 28 23:59:59 2025 GMT
*  subjectAltName: host "softwareupdate.vmware.com" matched cert's "softwareupdate.vmware.com"
*  issuer: C=US; O=DigiCert Inc; CN=DigiCert TLS RSA SHA256 2020 CA1
*  SSL certificate verify ok.
*   Certificate level 0: Public key type RSA (2048/112 Bits/secBits), signed using sha256WithRSAEncryption
*   Certificate level 1: Public key type RSA (2048/112 Bits/secBits), signed using sha256WithRSAEncryption
*   Certificate level 2: Public key type RSA (2048/112 Bits/secBits), signed using sha1WithRSAEncryption
* Connected to softwareupdate.vmware.com (172.66.0.165) port 443
* using HTTP/2
* [HTTP/2] [1] OPENED stream for https://softwareupdate.vmware.com/cds/vmw-desktop/ws/17.6.1/24319023/linux/core/VMware-Workstation-17.6.1-24319023.x86_64.bundle.tar
* [HTTP/2] [1] [:method: GET]
* [HTTP/2] [1] [:scheme: https]
* [HTTP/2] [1] [:authority: softwareupdate.vmware.com]
* [HTTP/2] [1] [:path: /cds/vmw-desktop/ws/17.6.1/24319023/linux/core/VMware-Workstation-17.6.1-24319023.x86_64.bundle.tar]
* [HTTP/2] [1] [user-agent: curl/8.12.1]
* [HTTP/2] [1] [accept: */*]
> GET /cds/vmw-desktop/ws/17.6.1/24319023/linux/core/VMware-Workstation-17.6.1-24319023.x86_64.bundle.tar HTTP/2
> Host: softwareupdate.vmware.com
> User-Agent: curl/8.12.1
> Accept: */*
> 
* Request completely sent off
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
< HTTP/2 301 
< date: Tue, 25 Mar 2025 14:41:55 GMT
< content-type: text/html
< content-length: 167
< location: https://support.broadcom.com
< cache-control: max-age=3600
< expires: Tue, 25 Mar 2025 15:41:55 GMT
< strict-transport-security: max-age=31536000; includeSubDomains
< content-security-policy: *
< expect-ct: enforce, max-age=300
< x-content-type-options: nosniff
< x-frame-options: SAMEORIGIN
< x-xss-protection: 1; mode=block
< server: cloudflare
< cf-ray: 925f2c03daff64d5-GIG
< 
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>cloudflare</center>
</body>
</html>
* Connection #0 to host softwareupdate.vmware.com left intact

cedric-lamalle avatar Mar 25 '25 14:03 cedric-lamalle

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/vmware-workstation-fails-to-unpack-tar-archive/62161/1

nixos-discourse avatar Mar 25 '25 19:03 nixos-discourse

I'm encountering the same issue on unstable NixOS and Nixpkgs for VMware Workstation, as discussed before, authentication is causing the build to fail.

Is there a way to authenticate the download issue or any workarounds to make the build work?

Environment:

  • NixOS Version: unstable
  • Nixpkgs Version: unstable
  • VMware Version: 17.6.1
  • Date: The issue persists as of 26.03.25

Daaboulex avatar Mar 26 '25 17:03 Daaboulex

Is there a way to authenticate the download issue or any workarounds to make the build work?

With a broadcom account, download the currently 17.6.1 vmware bundle file

Obtain the downloaded file's hash and add it to the nix store (edit the path here and run it)

nix hash to-sri --type sha256 $(nix-prefetch-url --type sha256 file:///home/your-user/Downloads/VMware-Workstation-17.6.1-24319023.x86_64.bundle.tar)

Add this to your config, update the hash that you got before and rebuild:

nixpkgs.overlays = [
  (
    final: prev:
    let
      finalAttrs = final.vmware-workstation;
      baseUrl = "https://softwareupdate.vmware.com/cds/vmw-desktop/ws/${finalAttrs.version}/${finalAttrs.build}/linux";
      vmware-unpack-env = prev.buildFHSEnv {
        pname = "vmware-unpack-env";
        inherit (finalAttrs) version;
        targetPkgs = pkgs: [ pkgs.zlib ];
      };
    in
    {
      vmware-workstation = prev.vmware-workstation.overrideAttrs rec {
        src = prev.requireFile rec {
          name = "VMware-Workstation-${finalAttrs.version}-${finalAttrs.build}.x86_64.bundle.tar";
          url = "${baseUrl}/core/${name}";
          hash = "sha256-FzcS/koLJTXiUWH5H1Au0Eiz8VAH8mboidkQeDLRPmQ=";
        };
        unpackPhase =''
          tar -xf ${src}
          ${vmware-unpack-env}/bin/vmware-unpack-env -c "sh VMware-Workstation-17.6.1-24319023.x86_64.bundle --extract unpacked"
        '';
      };
    }
  )
];

You may get a message that "Unfortunately, we cannot download file VMware-Workstation-17.6.1-24319023.x86_64.bundle.tar automatically.", follow the instructions in the error message, essentially run the following then rebuild again:

nix-store --add-fixed sha256 VMware-Workstation-17.6.1-24319023.x86_64.bundle.tar

In theory this should work for 17.6.1, newer versions probably require more tweaking. However I haven't tested it with an actual vmware file

Edit: updated the nix config because the previous didn't work

gepbird avatar Mar 26 '25 19:03 gepbird

There's a snapshot of the vmware site before they locked downloading behind a broadcom account, but looks like its for windows: https://archive.org/download/vmware-workstation-full-17.6.1-24319023_20241121 However the availability is not the best, and it's possible that it goes against their ToS or something

Edit: this should be a working link https://web.archive.org/web/20241118212048/https://softwareupdate.vmware.com/cds/vmw-desktop/ws/17.6.1/24319023/linux/core/

gepbird avatar Mar 27 '25 05:03 gepbird

Combining what I said in the last 2 comments, you can make it work automatically by adding this into your config:

  nixpkgs.overlays = [
    (
      final: prev:
      let
        finalAttrs = final.vmware-workstation;
        version = "17.6.1";
        build = "24319023";
        baseUrl = "https://web.archive.org/web/20241105192443if_/https://softwareupdate.vmware.com/cds/vmw-desktop/ws/${version}/${build}/linux";
        vmware-unpack-env = prev.buildFHSEnv {
          pname = "vmware-unpack-env";
          inherit version;
          targetPkgs = pkgs: [ pkgs.zlib ];
        };
      in
      {
        vmware-workstation = prev.vmware-workstation.overrideAttrs {
          src =
            prev.fetchzip {
              url = "${baseUrl}/core/VMware-Workstation-${version}-${build}.x86_64.bundle.tar";
              hash = "sha256-VzfiIawBDz0f1w3eynivW41Pn4SqvYf/8o9q14hln4s=";
              stripRoot = false;
            }
            + "/VMware-Workstation-${version}-${build}.x86_64.bundle";
          unpackPhase = ''
            ${vmware-unpack-env}/bin/vmware-unpack-env -c "sh ${finalAttrs.src} --extract unpacked"
          '';
        };
      }
    )
  ];

Do note that as this pins vmware workstation to the last publicly downloadable version using the internet archive, it may not work with newer kernels so you need to pin it (and pin vmware-modules) in the future.

gepbird avatar Apr 04 '25 08:04 gepbird

This workaround works for me.

siflfran avatar Apr 04 '25 09:04 siflfran

Hi,

Im share my package and if anyone want have all version here : https://github.com/liberodark/vmware/releases

{
  stdenv,
  buildFHSEnv,
  fetchzip,
  fetchurl,
  lib,
  zlib,
  gdbm,
  libxslt,
  libxml2,
  libuuid,
  readline,
  readline70,
  xz,
  cups,
  libaio,
  vulkan-loader,
  alsa-lib,
  libpulseaudio,
  libxcrypt-legacy,
  libGL,
  numactl,
  xorg,
  kmod,
  python3,
  autoPatchelfHook,
  makeWrapper,
  symlinkJoin,
  enableInstaller ? false,
  bzip2,
  sqlite,
  enableMacOSGuests ? false,
  fetchFromGitHub,
  unzip,
}:

let
  # base - versions
  version = "17.6.1";
  build = "24319023";

  # macOS - versions
  unlockerVersion = "3.0.5";

  # macOS - Unlocker
  unlockerSrc = fetchFromGitHub {
    owner = "paolo-projects";
    repo = "unlocker";
    rev = "${unlockerVersion}";
    sha256 = "sha256-JSEW1gqQuLGRkathlwZU/TnG6dL/xWKW4//SfE+kO0A=";
  };

  vmware-unpack-env = buildFHSEnv {
    pname = "vmware-unpack-env";
    inherit version;
    targetPkgs = pkgs: [ zlib ];
  };

  readline70_compat63 = symlinkJoin {
    name = "readline70_compat63";
    paths = [ readline70 ];
    postBuild = ''
      ln -s $out/lib/libreadline.so $out/lib/libreadline.so.6
    '';
  };
in
stdenv.mkDerivation rec {
  pname = "vmware-workstation";
  inherit version build;

  buildInputs = [
    libxslt
    libxml2
    libuuid
    gdbm
    readline
    xz
    cups
    libaio
    vulkan-loader
    alsa-lib
    libpulseaudio
    libxcrypt-legacy
    libGL
    numactl
    xorg.libX11
    xorg.libXau
    xorg.libXcomposite
    xorg.libXcursor
    xorg.libXdamage
    xorg.libXdmcp
    xorg.libXext
    xorg.libXfixes
    xorg.libXft
    xorg.libXinerama
    xorg.libXi
    xorg.libXrandr
    xorg.libXrender
    xorg.libXScrnSaver
    xorg.libXtst
  ];

  nativeBuildInputs =
    [
      python3
      vmware-unpack-env
      autoPatchelfHook
      makeWrapper
    ]
    ++ lib.optionals enableInstaller [
      bzip2
      sqlite
      readline70_compat63
    ]
    ++ lib.optionals enableMacOSGuests [ unzip ];

  src = fetchurl {
    url = "https://github.com/liberodark/vmware/releases/download/${version}/VMware-Workstation-Full-${version}-${build}.x86_64.bundle";
    hash = "sha256-e1Oar6glHnrztJ3BKimbEnk47wNV095o9hbOrD5Z4BY=";
  };

  unpackPhase = ''
    ${vmware-unpack-env}/bin/vmware-unpack-env -c "sh ${src} --extract unpacked"
  '';

  postPatch = 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 = ''
    runHook preInstall

    mkdir -p \
      $out/bin \
      $out/etc/vmware \
      $out/etc/init.d \
      $out/lib/vmware \
      $out/share/doc

    #### Replicate vmware-installer's order but VMX first because of appLoader
    ${lib.optionalString enableInstaller ''
      ## VMware installer
      echo "Installing VMware Installer"
      unpacked="unpacked/vmware-installer"
      vmware_installer_version=$(cat "unpacked/vmware-installer/manifest.xml" | grep -oPm1 "(?<=<version>)[^<]+")
      dest="$out/lib/vmware-installer/$vmware_installer_version"

      mkdir -p $dest
      cp -r $unpacked/vmis* $dest/
      cp -r $unpacked/sopython $dest/
      cp -r $unpacked/python $dest/
      cp -r $unpacked/cdsHelper $dest/
      cp -r $unpacked/vmware* $dest/
      cp -r $unpacked/bin $dest/
      cp -r $unpacked/lib $dest/

      chmod +x $dest/vmis-launcher $dest/sopython/* $dest/python/init.sh $dest/vmware-*
      ln -s $dest/vmware-installer $out/bin/vmware-installer

      mkdir -p $out/etc/vmware-installer
      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

      # create database of vmware guest tools (avoids vmware fetching them later)
      mkdir -p $out/etc/vmware-installer/components
      database_filename=$out/etc/vmware-installer/database
      touch $database_filename
      sqlite3 "$database_filename" "CREATE TABLE settings(key VARCHAR PRIMARY KEY, value VARCHAR NOT NULL, component_name VARCHAR NOT NULL);"
      sqlite3 "$database_filename" "INSERT INTO settings(key,value,component_name) VALUES('db.schemaVersion','2','vmware-installer');"
      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);"
      for folder in unpacked/**/.installer ; do
        component="$(basename $(dirname $folder))"
        component_version=$(cat unpacked/$component/manifest.xml | grep -oPm1 "(?<=<version>)[^<]+")
        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);"
        mkdir -p $out/etc/vmware-installer/components/$component
        cp -r $folder/* $out/etc/vmware-installer/components/$component
      done
    ''}

    ## VMware Bootstrap
    echo "Installing VMware Bootstrap"
    cp ${./vmware-bootstrap} $out/etc/vmware/bootstrap
    sed -i -e "s,@@PREFIXDIR@@,$out," $out/etc/vmware/bootstrap

    ## 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,@@PREFIXDIR@@,$out," $out/etc/vmware/config

    ## VMware VMX
    echo "Installing VMware VMX"
    unpacked="unpacked/vmware-vmx"
    cp -r $unpacked/bin/* $out/bin/
    cp -r $unpacked/etc/modprobe.d $out/etc/
    cp -r $unpacked/etc/init.d/* $out/etc/init.d/
    cp -r $unpacked/roms $out/lib/vmware/
    cp -r $unpacked/sbin/* $out/bin/

    cp -r $unpacked/lib/libconf $out/lib/vmware/
    rm $out/lib/vmware/libconf/etc/fonts/fonts.conf

    cp -r $unpacked/lib/bin $out/lib/vmware/
    cp -r $unpacked/lib/lib $out/lib/vmware/
    cp -r $unpacked/lib/scripts $out/lib/vmware/
    cp -r $unpacked/lib/icu $out/lib/vmware/
    cp -r $unpacked/lib/share $out/lib/vmware/
    cp -r $unpacked/lib/modules $out/lib/vmware/
    cp -r $unpacked/lib/include $out/lib/vmware/

    cp -r $unpacked/extra/checkvm $out/bin/
    cp -r $unpacked/extra/modules.xml $out/lib/vmware/modules/

    ln -s $out/lib/vmware/bin/appLoader $out/lib/vmware/bin/vmware-vmblock-fuse
    ln -s $out/lib/vmware/icu $out/etc/vmware/icu

    # Replace vmware-modconfig with simple error dialog
    cp ${./vmware-modconfig} $out/bin/vmware-modconfig
    sed -i -e "s,ETCDIR=/etc/vmware,ETCDIR=$out/etc/vmware," $out/bin/vmware-modconfig

    # Patch dynamic libs in
    for binary in "mksSandbox" "mksSandbox-debug" "mksSandbox-stats" "vmware-vmx" "vmware-vmx-debug" "vmware-vmx-stats"
    do
      patchelf \
        --add-needed ${libaio}/lib/libaio.so.1 \
        --add-needed ${vulkan-loader}/lib/libvulkan.so.1 \
        --add-needed ${alsa-lib}/lib/libasound.so \
        --add-needed ${libpulseaudio}/lib/libpulse.so.0 \
        --add-needed ${libGL}/lib/libEGL.so.1 \
        --add-needed ${numactl}/lib/libnuma.so.1 \
        --add-needed ${xorg.libX11}/lib/libX11.so.6 \
        --add-needed ${xorg.libXi}/lib/libXi.so.6 \
        --add-needed ${libGL}/lib/libGL.so.1 \
        $out/lib/vmware/bin/$binary
    done

    ## VMware USB Arbitrator
    echo "Installing VMware USB Arbitrator"
    unpacked="unpacked/vmware-usbarbitrator"
    cp -r $unpacked/etc/init.d/* $out/etc/init.d/
    cp -r $unpacked/bin/* $out/bin/
    ln -s $out/lib/vmware/bin/appLoader $out/lib/vmware/bin/vmware-usbarbitrator

    ## VMware Player Setup
    echo "Installing VMware Player Setup"
    unpacked="unpacked/vmware-player-setup"
    mkdir -p $out/lib/vmware/setup
    cp $unpacked/vmware-config $out/lib/vmware/setup/

    ## VMware Network Editor
    echo "Installing VMware Network Editor"
    unpacked="unpacked/vmware-network-editor"
    cp -r $unpacked/lib $out/lib/vmware/

    ## VMware Player Application
    echo "Installing VMware Player Application"
    unpacked="unpacked/vmware-player-app"
    cp -r $unpacked/lib/* $out/lib/vmware/
    cp -r $unpacked/share/* $out/share/
    cp -r $unpacked/bin/* $out/bin/
    cp -r $unpacked/doc/* $out/share/doc/ # Licences

    for target in "vmplayer" "vmware-enter-serial" "vmware-setup-helper" "licenseTool" "vmware-mount" "vmware-fuseUI" "vmware-app-control" "vmware-zenity"
    do
      ln -s $out/lib/vmware/bin/appLoader $out/lib/vmware/bin/$target
    done

    ln -s $out/lib/vmware/bin/vmware-mount $out/bin/vmware-mount
    ln -s $out/lib/vmware/bin/vmware-fuseUI $out/bin/vmware-fuseUI
    ln -s $out/lib/vmware/bin/vmrest $out/bin/vmrest

    # Patch vmplayer
    sed -i -e "s,ETCDIR=/etc/vmware,ETCDIR=$out/etc/vmware," $out/bin/vmplayer
    sed -i -e "s,/sbin/modprobe,${kmod}/bin/modprobe," $out/bin/vmplayer
    sed -i -e "s,@@BINARY@@,$out/bin/vmplayer," $out/share/applications/vmware-player.desktop

    ## VMware OVF Tool component
    echo "Installing VMware OVF Tool for Linux"
    unpacked="unpacked/vmware-ovftool"
    mkdir -p $out/lib/vmware-ovftool/

    cp -r $unpacked/* $out/lib/vmware-ovftool/
    chmod 755 $out/lib/vmware-ovftool/ovftool*
    makeWrapper "$out/lib/vmware-ovftool/ovftool.bin" "$out/bin/ovftool"

    ## VMware Network Editor User Interface
    echo "Installing VMware Network Editor User Interface"
    unpacked="unpacked/vmware-network-editor-ui"
    cp -r $unpacked/share/* $out/share/

    ln -s $out/lib/vmware/bin/appLoader $out/lib/vmware/bin/vmware-netcfg
    ln -s $out/lib/vmware/bin/vmware-netcfg $out/bin/vmware-netcfg

    # Patch network editor ui

    sed -i -e "s,@@BINARY@@,$out/bin/vmware-netcfg," $out/share/applications/vmware-netcfg.desktop

    ## VMware VIX Core Library
    echo "Installing VMware VIX Core Library"
    unpacked="unpacked/vmware-vix-core"
    mkdir -p $out/lib/vmware-vix
    cp -r $unpacked/lib/* $out/lib/vmware-vix/
    cp -r $unpacked/bin/* $out/bin/
    cp $unpacked/*.txt $out/lib/vmware-vix/

    mkdir -p $out/share/doc/vmware-vix/
    cp -r $unpacked/doc/* $out/share/doc/vmware-vix/

    mkdir -p $out/include/
    cp -r $unpacked/include/* $out/include/

    ## 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
    echo "Installing VMware VProbes component for Linux"
    unpacked="unpacked/vmware-vprobe"
    cp -r $unpacked/bin/* $out/bin/
    cp -r $unpacked/lib/* $out/lib/vmware/

    ## VMware Workstation
    echo "Installing VMware Workstation"
    unpacked="unpacked/vmware-workstation"
    cp -r $unpacked/bin/* $out/bin/
    cp -r $unpacked/lib/* $out/lib/vmware/
    cp -r $unpacked/share/* $out/share/
    cp -r $unpacked/man $out/share/
    cp -r $unpacked/doc $out/share/

    ln -s $out/lib/vmware/bin/appLoader $out/lib/vmware/bin/vmware
    ln -s $out/lib/vmware/bin/appLoader $out/lib/vmware/bin/vmware-tray
    ln -s $out/lib/vmware/bin/appLoader $out/lib/vmware/bin/vmware-vprobe

    # Patch vmware
    sed -i -e "s,ETCDIR=/etc/vmware,ETCDIR=$out/etc/vmware,g" $out/bin/vmware
    sed -i -e "s,/sbin/modprobe,${kmod}/bin/modprobe,g" $out/bin/vmware
    sed -i -e "s,@@BINARY@@,$out/bin/vmware," $out/share/applications/vmware-workstation.desktop

    chmod +x $out/bin/* $out/lib/vmware/bin/* $out/lib/vmware/setup/*

    # Hardcoded pkexec hack
    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"
    do
      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
    ln -s /run/wrappers/bin/vmware-vmx $out/lib/vmware/bin/vmware-vmx

    # Remove shipped X11 libraries
    for lib in $out/lib/vmware/lib/* $out/lib/vmware-ovftool/lib*.so*; do
      lib_name="$(basename "$lib")"
      if [[ "$lib_name" == libX* || "$lib_name" == libxcb* ]]; then
        rm -rf "$lib"
      fi
    done

    runHook postInstall
  '';

  meta = with lib; {
    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;
    platforms = [ "x86_64-linux" ];
    maintainers = with maintainers; [
      cawilliamson
      deinferno
      vifino
    ];
  };
}

vmware-workstation.tar.gz

liberodark avatar Apr 08 '25 08:04 liberodark

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/thinlinc-client-not-working/63662/15

nixos-discourse avatar May 07 '25 22:05 nixos-discourse