How to install a package that was manually downloaded?

I want to install vmware-workstation
https://search.nixos.org/packages?channel=23.11&from=0&size=50&sort=relevance&type=packages&query=vmware+workstation

but the source site is down for maintenance, and will continue to be for a while
store-us.vmware.com/workstation_buy_dual
Build failure: vmware-workstation · Issue #310121 · NixOS/nixpkgs (github.com)

So if I try to install it, I get

building Nix...
building the system configuration...
building '/nix/store/vh6yjal2lyp9va5k5p5shv073jzsgay3-VMware-Workstation-Full-17.5.1-23298084.x86_64.bundle.drv'...
building '/nix/store/4slcz39jjfqb73rjqc2kbqqb9i6nppjy-gdbm-1.8.3.drv'...
building '/nix/store/gqwx8nkfw2m5xw92y6k3s4a3a2iqzrzn-vmware-unpack-env-usr-target.drv'...
Running phase: unpackPhase
unpacking source archive /nix/store/hh149gw57kdvafpqjfq3869x4zkkgdr7-gdbm-1.8.3.tar.gz
source root is gdbm-1.8.3
setting SOURCE_DATE_EPOCH to timestamp 1034719556 of file gdbm-1.8.3/gdbm.info
Running phase: patchPhase
Running phase: updateAutotoolsGnuConfigScriptsPhase
Updating Autotools / GNU config script to a newer upstream version: ./config.sub
Updating Autotools / GNU config script to a newer upstream version: ./config.guess
Running phase: configurePhase
fixing libtool script ./ltmain.sh
patching script interpreter paths in ./configure
./configure: interpreter directive changed from "#! /bin/sh" to "/nix/store/h3bhzvz9ipglcybbcvkxvm4vg9lwvqg4-bash-5.2p26/bin/sh"
configure flags: --disable-static --prefix=/nix/store/2gyp500pg8byyrbd9n4j6ijpbgb9ry4z-gdbm-1.8.3 --enable-libgdbm-compat
warning: collision between `/nix/store/nkdgysx90pln2l562l7lsk021hbxjdg8-glibc-2.39-31-bin/bin/ldconfig' and `/nix/store/d130xwm9365hfdzpz7x5kq9is9q6l4rm-ldconfig/bin/ldconfig'
warning: collision between `/nix/store/apab5i73dqa09wx0q27b6fbhd1r18ihl-glibc-2.39-31/lib/locale/locale-archive' and `/nix/store/j2h103h7b0xg7pc5ih3m1df0j3z71c6v-glibc-locales-2.39-31/lib/locale/locale-archive'
checking for gcc... gcc
created 1125 symlinks in user environment
building '/nix/store/jyymlbz15czjll8hac5qddil8afar8rf-vmware-unpack-env-fhs.drv'...
checking for C compiler default output... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
/nix/store/4hfpf6kn1fj2r1dxpn8dz7zqdnm3j12l-vmware-unpack-env-fhs /build
/nix/store/4hfpf6kn1fj2r1dxpn8dz7zqdnm3j12l-vmware-unpack-env-fhs/usr /nix/store/4hfpf6kn1fj2r1dxpn8dz7zqdnm3j12l-vmware-unpack-env-fhs /build
/nix/store/4hfpf6kn1fj2r1dxpn8dz7zqdnm3j12l-vmware-unpack-env-fhs /build
building '/nix/store/pl6gzr7sjfznn331rkp6iqs439nxav3s-vmware-unpack-env-bwrap.drv'...

trying https://download3.vmware.com/software/WKST-1751-LX/VMware-Workstation-Full-17.5.1-23298084.x86_64.bundle
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
checking for gcc option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -E
checking for a BSD-compatible install... /nix/store/hq8765g3p1i7qbargnqli5mn0jpsdbfl-coreutils-9.5/bin/install -c
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for ld used by GCC... ld
checking if the linker (ld) is GNU ld... yes
checking for ld option to reload object files... -r
checking for BSD-compatible nm... nm
checking whether ln -s works... yes
checking how to recognise dependant libraries... (cached) pass_all
building '/nix/store/5l3rqri02lk0vlsshzxavdsd240zcm30-vmware-unpack-env.drv'...
checking command to parse nm output... ok
checking for egrep... grep -E
  0    15    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (56) The requested URL returned error: 522
error: cannot download VMware-Workstation-Full-17.5.1-23298084.x86_64.bundle from any mirror
checking for ANSI C header files... yes
error: builder for '/nix/store/vh6yjal2lyp9va5k5p5shv073jzsgay3-VMware-Workstation-Full-17.5.1-23298084.x86_64.bundle.drv' failed with exit code 1
error:
       … while calling the 'head' builtin

         at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:1575:11:

         1574|         || pred here (elemAt values 1) (head values) then
         1575|           head values
             |           ^
         1576|         else

       … while evaluating the attribute 'value'

         at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:809:9:

          808|     in warnDeprecation opt //
          809|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          810|         inherit (res.defsFinal') highestPrio;

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: 1 dependencies of derivation '/nix/store/6zl9d3wlrw7s6p63l9agnangra8yfqdm-vmware-workstation-17.5.1.drv' failed to build

But I obtained a source file “VMware-Workstation-Full-17.5.0-22583795.x86_64.bundle”
from techspot

(I know the link says it is for windows, but there is a download also for linux)
Can I use this somehow?

You can override the src attribute of it using overrideAttrs. I read through the derivation for vmware-workstation and it looks like the unpackPhase refers to the src attribute, so the unpackPhase attribute would also need to be overridden. The following code got it past the unpack phase, but I didn’t let it build until the end:

(pkgs.vmware-workstation.overrideAttrs rec {
  src = ./vmware.bundle;
  unpackPhase = let
    vmware-unpack-env = pkgs.buildFHSEnv rec {
      name = "vmware-unpack-env";
      targetPkgs = pkgs: [ pkgs.zlib ];
    };
  in ''
    ${vmware-unpack-env}/bin/vmware-unpack-env -c "sh ${src} --extract unpacked"
    # If you need it, copy the enableMacOSGuests stuff here as well.
  '';
})

For use with the vmware NixOS module, see my comment #9 in this thread.

3 Likes

Thanks, I will have to try that out!

I put it in configuration.nix as a separate section and I am getting an error. Maybe it belongs somewhere else?

error:
       … while evaluating the attribute 'config'

         at /nix/store/8sha7nwyiwd35l0hsb92c8vghbrh0qz8-nixos-23.11.6981.27c13997bf45/nixos/lib/modules.nix:320:9:

          319|         options = checked options;
          320|         config = checked (removeAttrs config [ "_module" ]);
             |         ^
          321|         _module = checked (config._module);

       … while calling the 'seq' builtin

         at /nix/store/8sha7nwyiwd35l0hsb92c8vghbrh0qz8-nixos-23.11.6981.27c13997bf45/nixos/lib/modules.nix:320:18:

          319|         options = checked options;
          320|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          321|         _module = checked (config._module);

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: syntax error, unexpected '('

       at /etc/nixos/configuration.nix:122:3:

          121|
          122|   (pkgs.vmware-workstation.overrideAttrs rec {
             |   ^
          123|   src = "/home/shmuel/Documents/VMware-WorkstationVMware-Workstation-Full-17.5.0-22583795.x86_64.bundle-Full-17.5.0-22583795.x86_64.bundle";
building Nix...
error:
       … while evaluating the attribute 'config'

         at /nix/store/8sha7nwyiwd35l0hsb92c8vghbrh0qz8-nixos-23.11.6981.27c13997bf45/nixos/lib/modules.nix:320:9:

          319|         options = checked options;
          320|         config = checked (removeAttrs config [ "_module" ]);
             |         ^
          321|         _module = checked (config._module);

       … while calling the 'seq' builtin

         at /nix/store/8sha7nwyiwd35l0hsb92c8vghbrh0qz8-nixos-23.11.6981.27c13997bf45/nixos/lib/modules.nix:320:18:

          319|         options = checked options;
          320|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          321|         _module = checked (config._module);

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: syntax error, unexpected '('

       at /etc/nixos/configuration.nix:122:3:

          121|
          122|   (pkgs.vmware-workstation.overrideAttrs rec {
             |   ^
          123|   src = "/home/shmuel/Documents/VMware-WorkstationVMware-Workstation-Full-17.5.0-22583795.x86_64.bundle-Full-17.5.0-22583795.x86_64.bundle";
building the system configuration...
error:
       … while evaluating the attribute 'config.system.build.toplevel'

         at /nix/store/8sha7nwyiwd35l0hsb92c8vghbrh0qz8-nixos-23.11.6981.27c13997bf45/nixos/lib/modules.nix:320:9:

          319|         options = checked options;
          320|         config = checked (removeAttrs config [ "_module" ]);
             |         ^
          321|         _module = checked (config._module);

       … while calling the 'seq' builtin

         at /nix/store/8sha7nwyiwd35l0hsb92c8vghbrh0qz8-nixos-23.11.6981.27c13997bf45/nixos/lib/modules.nix:320:18:

          319|         options = checked options;
          320|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          321|         _module = checked (config._module);

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: syntax error, unexpected '('

       at /etc/nixos/configuration.nix:122:3:

          121|
          122|   (pkgs.vmware-workstation.overrideAttrs rec {
             |   ^
          123|   src = "/home/shmuel/Documents/VMware-WorkstationVMware-Workstation-Full-17.5.0-22583795.x86_64.bundle-Full-17.5.0-22583795.x86_64.bundle";

1 Like

The documentation for nix-prefetch-url mentions:

If hash is specified, then a download is not performed if the Nix store already contains a file with the same hash and base name.

A cheesy way to get the desired file into the store is to run a static server on localhost (e.g. python -m http.server or whatever), then using nix-prefetch invoke the command:

$ nix-prefetch fetchurl --no-force-https --url http://localhost:8000/somefile.zip
The fetcher will be called as follows:
> fetchurl {
>   sha256 = "sha256:0000000000000000000000000000000000000000000000000000";
>   url = "http://localhost:8000/somefile.zip";
> }

sha256-4npR61/tABv4LYVvmulJy5cAvNN1rKc8UQFLjbgbpkw=

Then, since the file is copied to the Nix store (with the same basename and same hash), you wouldn’t need to fuss around with overriding the src attribute.

1 Like

The result of overriding some attributes in a derivation is also a derivation, so it’s to be put into environment.systemPackages along with other packages. Example:

environment.systemPackages = [
  (pkgs.vmware-workstation.overrideAttrs rec {
    #...
  })
  # Other packages here
];
1 Like

I am sure this will be helpful for users more experienced than me in running servers.

I found that there’s a vmware module in NixOS, and it’s advisable to use it instead of just adding it to environment.systemPackages, because the module handles things like kernel modules and networking as well. The relevant options are under virtualisation.vmware.host.*. To use the module with the overridden package:

virtualisation.vmware.host.enable = true;
virtualisation.vmware.host.package = (pkgs.vmware-workstation.overrideAttrs rec {
  # ...
});
2 Likes

error:
… while evaluating the attribute ‘config’

     at /nix/store/8sha7nwyiwd35l0hsb92c8vghbrh0qz8-nixos-23.11.6981.27c13997bf45/nixos/lib/modules.nix:320:9:

      319|         options = checked options;
      320|         config = checked (removeAttrs config [ "_module" ]);
         |         ^
      321|         _module = checked (config._module);

   … while calling the 'seq' builtin

     at /nix/store/8sha7nwyiwd35l0hsb92c8vghbrh0qz8-nixos-23.11.6981.27c13997bf45/nixos/lib/modules.nix:320:18:

      319|         options = checked options;
      320|         config = checked (removeAttrs config [ "_module" ]);
         |                  ^
      321|         _module = checked (config._module);

   (stack trace truncated; use '--show-trace' to show the full trace)

   error: undefined variable 'zlib'

   at /etc/nixos/configuration.nix:74:28:

       73|       name = "vmware-unpack-env";
       74|       targetPkgs = pkgs: [ zlib ];
         |                            ^
       75|     };

building Nix…
error:
… while evaluating the attribute ‘config’

     at /nix/store/8sha7nwyiwd35l0hsb92c8vghbrh0qz8-nixos-23.11.6981.27c13997bf45/nixos/lib/modules.nix:320:9:

      319|         options = checked options;
      320|         config = checked (removeAttrs config [ "_module" ]);
         |         ^
      321|         _module = checked (config._module);

   … while calling the 'seq' builtin

     at /nix/store/8sha7nwyiwd35l0hsb92c8vghbrh0qz8-nixos-23.11.6981.27c13997bf45/nixos/lib/modules.nix:320:18:

      319|         options = checked options;
      320|         config = checked (removeAttrs config [ "_module" ]);
         |                  ^
      321|         _module = checked (config._module);

   (stack trace truncated; use '--show-trace' to show the full trace)

   error: undefined variable 'zlib'

   at /etc/nixos/configuration.nix:74:28:

       73|       name = "vmware-unpack-env";
       74|       targetPkgs = pkgs: [ zlib ];
         |                            ^
       75|     };

building the system configuration…
error:
… while evaluating the attribute ‘config.system.build.toplevel’

     at /nix/store/8sha7nwyiwd35l0hsb92c8vghbrh0qz8-nixos-23.11.6981.27c13997bf45/nixos/lib/modules.nix:320:9:

      319|         options = checked options;
      320|         config = checked (removeAttrs config [ "_module" ]);
         |         ^
      321|         _module = checked (config._module);

   … while calling the 'seq' builtin

     at /nix/store/8sha7nwyiwd35l0hsb92c8vghbrh0qz8-nixos-23.11.6981.27c13997bf45/nixos/lib/modules.nix:320:18:

      319|         options = checked options;
      320|         config = checked (removeAttrs config [ "_module" ]);
         |                  ^
      321|         _module = checked (config._module);

   (stack trace truncated; use '--show-trace' to show the full trace)

   error: undefined variable 'zlib'

   at /etc/nixos/configuration.nix:74:28:

       73|       name = "vmware-unpack-env";
       74|       targetPkgs = pkgs: [ zlib ];
         |                            ^
       75|     };

My bad, I tested it under a with pkgs without noticing. Replace zlib with pkgs.zlib.

So I have like this:

virtualisation.vmware.host.enable = true;
  virtualisation.vmware.host.package = (pkgs.vmware-workstation.overrideAttrs {
src = ./vmware.bundle;
  unpackPhase = let
    vmware-unpack-env = pkgs.buildFHSEnv rec {
      name = "vmware-unpack-env";
      targetPkgs = pkgs: [ pkgs.zlib ];
    };
  in ''
    ${vmware-unpack-env}/bin/vmware-unpack-env -c "sh ${src} --extract unpacked"
    # If you need it, copy the enableMacOSGuests stuff here as well.
  '';
});

And I get this error:

error:
       … while evaluating the attribute 'config'

         at /nix/store/8sha7nwyiwd35l0hsb92c8vghbrh0qz8-nixos-23.11.6981.27c13997bf45/nixos/lib/modules.nix:320:9:

          319|         options = checked options;
          320|         config = checked (removeAttrs config [ "_module" ]);
             |         ^
          321|         _module = checked (config._module);

       … while calling the 'seq' builtin

         at /nix/store/8sha7nwyiwd35l0hsb92c8vghbrh0qz8-nixos-23.11.6981.27c13997bf45/nixos/lib/modules.nix:320:18:

          319|         options = checked options;
          320|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          321|         _module = checked (config._module);

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: undefined variable 'src'

       at /etc/nixos/configuration.nix:148:57:

          147|   in ''
          148|     ${vmware-unpack-env}/bin/vmware-unpack-env -c "sh ${src} --extract unpacked"
             |                                                         ^
          149|     # If you need it, copy the enableMacOSGuests stuff here as well.
building Nix...
error:
       … while evaluating the attribute 'config'

         at /nix/store/8sha7nwyiwd35l0hsb92c8vghbrh0qz8-nixos-23.11.6981.27c13997bf45/nixos/lib/modules.nix:320:9:

          319|         options = checked options;
          320|         config = checked (removeAttrs config [ "_module" ]);
             |         ^
          321|         _module = checked (config._module);

       … while calling the 'seq' builtin

         at /nix/store/8sha7nwyiwd35l0hsb92c8vghbrh0qz8-nixos-23.11.6981.27c13997bf45/nixos/lib/modules.nix:320:18:

          319|         options = checked options;
          320|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          321|         _module = checked (config._module);

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: undefined variable 'src'

       at /etc/nixos/configuration.nix:148:57:

          147|   in ''
          148|     ${vmware-unpack-env}/bin/vmware-unpack-env -c "sh ${src} --extract unpacked"
             |                                                         ^
          149|     # If you need it, copy the enableMacOSGuests stuff here as well.
building the system configuration...
error:
       … while evaluating the attribute 'config.system.build.toplevel'

         at /nix/store/8sha7nwyiwd35l0hsb92c8vghbrh0qz8-nixos-23.11.6981.27c13997bf45/nixos/lib/modules.nix:320:9:

          319|         options = checked options;
          320|         config = checked (removeAttrs config [ "_module" ]);
             |         ^
          321|         _module = checked (config._module);

       … while calling the 'seq' builtin

         at /nix/store/8sha7nwyiwd35l0hsb92c8vghbrh0qz8-nixos-23.11.6981.27c13997bf45/nixos/lib/modules.nix:320:18:

          319|         options = checked options;
          320|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          321|         _module = checked (config._module);

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: undefined variable 'src'

       at /etc/nixos/configuration.nix:148:57:

          147|   in ''
          148|     ${vmware-unpack-env}/bin/vmware-unpack-env -c "sh ${src} --extract unpacked"
             |                                                         ^
          149|     # If you need it, copy the enableMacOSGuests stuff here as well.

I used a rec set there in my first comment but omitted it in my subsequent comments. Sorry for the confusion caused—the rec set is required:

- virtualisation.vmware.host.package = (pkgs.vmware-workstation.overrideAttrs {
+ virtualisation.vmware.host.package = (pkgs.vmware-workstation.overrideAttrs rec {
1 Like

Perfect, that does it. Now back to work…

1 Like

For those looking for a download,
The vmware update server still has it
https://softwareupdate.vmware.com/cds/vmw-desktop/ws/17.5.2/23775571/linux/core/

2 Likes

Tried to install it with the vmware bundle locally, but I get this:

       … while calling the 'head' builtin

         at /nix/store/pnylamisx45d9dig55305gpq0xj2v7ki-source/lib/attrsets.nix:922:11:

          921|         || pred here (elemAt values 1) (head values) then
          922|           head values
             |           ^
          923|         else

       … while evaluating the attribute 'value'

         at /nix/store/pnylamisx45d9dig55305gpq0xj2v7ki-source/lib/modules.nix:807:9:

          806|     in warnDeprecation opt //
          807|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          808|         inherit (res.defsFinal') highestPrio;

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: builder for '/nix/store/z1fccsqrkcyk1hf2yqpag86353l0p2bd-vmware-workstation-17.5.1.drv' failed with exit code 1;
       last 10 log lines:
       > Installing VMware Player Setup
       > Installing VMware Network Editor
       > Installing VMware Tools
       > cp: cannot stat 'unpacked/vmware-tools-linux/linux.iso': No such file or directory
       > cp: cannot stat 'unpacked/vmware-tools-linuxPreGlibc25/linuxPreGlibc25.iso': No such file or directory
       > cp: cannot stat 'unpacked/vmware-tools-netware/netware.iso': No such file or directory
       > cp: cannot stat 'unpacked/vmware-tools-solaris/solaris.iso': No such file or directory
       > cp: cannot stat 'unpacked/vmware-tools-winPre2k/winPre2k.iso': No such file or directory
       > cp: cannot stat 'unpacked/vmware-tools-winPreVista/winPreVista.iso': No such file or directory
       > cp: cannot stat 'unpacked/vmware-tools-windows/windows.iso': No such file or directory
       For full logs, run 'nix log /nix/store/z1fccsqrkcyk1hf2yqpag86353l0p2bd-vmware-workstation-17.5.1.drv'.

any idea why?
(using the expression @kotatsuyaki provided):

  environment.systemPackages = with pkgs; [
    vmfs-tools
    open-vm-tools
  ];

  virtualisation = {
    vmware = {
      host = {
        enable = true;
        package = pkgs.vmware-workstation.overrideAttrs rec {
          src = ./vmware.bundle;
          unpackPhase = let
            vmware-unpack-env = pkgs.buildFHSEnv rec {
              name = "vmware-unpack-env";
              targetPkgs = pkgs: [pkgs.zlib];
            };
          in ''
            ${vmware-unpack-env}/bin/vmware-unpack-env -c "sh ${src} --extract unpacked"
          '';
        };
      };
    };
};

If you are using the bundle from here:
https://softwareupdate.vmware.com/cds/vmw-desktop/ws/17.5.2/23775571/linux/core/
I had similar issues. The package seems to be incomplete.
Trying using the bundle from here:
Now downloading: VMware Workstation 17.5.2 | TechSpot

2 Likes

Slightly off-topic question, was anyone able to connect to his new vmware customer account since the migration to Broadcom ?

I did succeed, after a few tries and making a new password once or twice.