Manage VMware Fusion on macOS with Nix.
The flake is currently pinned to VMware Fusion 26H1u1 (build 25689522) for
Macs with Apple silicon.
Sign in to the VMware Fusion 26H1u1 downloads page and download this file:
VMware-Fusion-26H1u1-25689522_universal.dmg
If prompted, review and accept Broadcom's Terms and Conditions and complete the Trade Compliance form. Broadcom's download instructions explain these steps.
# Replace this path if the DMG is elsewhere.
dmg="$HOME/Downloads/VMware-Fusion-26H1u1-25689522_universal.dmg"
nix store add \
--mode flat \
--hash-algo sha256 \
--name VMware-Fusion-26H1u1-25689522_universal.dmg \
"$dmg"Note
You will only need to import the DMG once per pinned VMware Fusion build.
Add the module to your nix-darwin configuration:
{
inputs.nix-vmware-fusion = {
url = "github:pradyuman/nix-vmware-fusion";
inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { nix-darwin, nix-vmware-fusion, ... }: {
darwinConfigurations.my-mac = nix-darwin.lib.darwinSystem {
modules = [
nix-vmware-fusion.darwinModules.default
{
programs.vmware-fusion.enable = true;
}
];
};
};
}On activation, the module installs the pinned build and adds the following to the system profile:
nix-vmware-fusion, withinstall,uninstall, andpurgesubcommands- VMware Fusion's bundled command-line tools, including
vmrun,vmcli,vmrest,vmnet-cli, andovftool
To manage VMware Fusion's system-wide networks, set:
# vmnet8 is VMware Fusion's default NAT network.
programs.vmware-fusion.networking.networks.vmnet8 = {
subnet = {
address = "192.168.200.0";
prefixLength = 24;
};
dhcp.enable = true;
nat.enable = true;
hostAdapter.enable = true;
};The module only adds, updates, or removes networks it manages or has previously managed.
If you do not use nix-darwin, you can run the installer directly:
NIXPKGS_ALLOW_UNFREE=1 nix run --impure github:pradyuman/nix-vmware-fusion -- installThe installer uses sudo to install the app in /Applications and initialize
VMware's privileged helpers.
To manage user preferences, use the Home Manager module:
{
imports = [ nix-vmware-fusion.homeModules.default ];
programs.vmware-fusion = {
enable = true;
settings = {
appearance = "dark";
confirmBeforeClosing = true;
dataCollection = false;
display = {
singleWindowFit = "resize";
fullScreenFit = "resize";
};
# Passed through as a raw VMware preference.
mapISONumpadEnterToAltGrEnabled = false;
};
};
}The module supports these settings:
| Setting | Values | Description |
|---|---|---|
appearance |
"auto", "light", "dark" |
VMware Fusion's appearance. |
closeAction |
"suspend", "power-off" |
Action to take when closing a virtual machine window. |
confirmBeforeClosing |
true, false |
Whether to confirm before closing a virtual machine or Fusion. |
gamingMouseMode |
"auto", "never", "always" |
When to optimize the mouse for games. |
dataCollection |
true, false |
Whether to participate in VMware's data collection program. |
perVmKeyboardShortcuts |
true, false |
Whether to enable per-virtual machine keyboard shortcuts. |
display.singleWindowFit |
"stretch", "resize" |
How to size the virtual machine display in single-window mode. |
display.fullScreenFit |
"center", "stretch", "resize" |
How to size the virtual machine display in full-screen mode. |
To manage a setting that is not listed above, add its VMware preference key to
settings without the pref. prefix. Settings you do not specify are left
unchanged.
Quit VMware Fusion before activating your Home Manager configuration, then reopen it afterward so the new settings take effect.
To create a VM or configure an existing one, use the Home Manager module:
programs.vmware-fusion = {
enable = true;
virtualMachines.asuna = {
guestOS = "arm-other6xlinux-64";
vcpus = 2;
memory = 8192;
secureBoot = false;
networkAdapters.primary = {
mode = "nat";
};
disks.primary = {
size = 64;
bus = "nvme";
};
sharedFolders.projects.hostPath = "/Users/asuna/projects";
};
};By default, the module creates or updates
~/Virtual Machines.localized/<name>.vmwarevm,
where <name> is the attribute name (asuna above). Use path to specify a
different location.
The module only manages virtual machines listed in your configuration and leaves any others on your system untouched. If you remove a virtual machine from your configuration, the module stops managing it (but doesn't delete it).
Important
nix-vmware-fusion will return an error if it tries to change the
configuration of a running virtual machine. Make sure to shut down any
virtual machines you're changing before activating a new configuration.
By default, VMware Fusion chooses a socket topology for vcpus when the VM
powers on. Set coresPerSocket to use a specific topology:
programs.vmware-fusion.virtualMachines.asuna = {
vcpus = 8;
coresPerSocket = 4; # 2 sockets with 4 cores each
# ...
};Removing coresPerSocket from your configuration restores VMware Fusion's
default behavior.
Declare every virtual network adapter that should be attached to the VM:
programs.vmware-fusion.virtualMachines.asuna = {
# ...
networkAdapters = {
primary = {
mode = "nat";
model = "vmxnet3";
startConnected = true;
};
};
};Each adapter supports the following settings:
| Setting | Type | Default | Description |
|---|---|---|---|
mode |
"nat", "bridged", "host-only", or "custom" |
"nat" |
How the adapter connects to the host network |
vmnet |
String | — | VMware network to use with "custom" mode (required) |
model |
"vmxnet3", "e1000e", or "e1000" |
"vmxnet3" |
Virtual network adapter model. Use E1000E or E1000 when the guest does not support VMXNET3 |
startConnected |
Boolean | true |
Whether to connect the adapter when the virtual machine starts |
Removing an adapter declaration will remove it from the VM.
Declare every virtual disk that should be attached to the VM:
programs.vmware-fusion.virtualMachines.asuna = {
# ...
disks = {
primary = {
size = 64;
bus = "nvme";
preallocate = false;
split = true;
};
};
};Each disk supports the following settings:
| Setting | Type | Default | Description |
|---|---|---|---|
path |
String | <bundle>/<name>.vmdk |
Disk location, where <name> is the attribute name (primary above) |
size |
Positive integer | — | Disk capacity in GiB (required) |
bus |
"nvme" or "sata" |
"nvme" |
Bus used to attach the disk |
preallocate |
Boolean | false |
Reserve the disk's full capacity on the host instead of growing as data is written |
split |
Boolean | false |
Store the disk across multiple files instead of a single file |
When changing disk settings, keep in mind:
- You can expand a disk, but not shrink it.
- Expanding a disk does not resize its partitions or filesystems inside the guest.
- Changing
preallocateorsplitwill convert the virtual disk to the target format.
Removing a disk declaration will detach it from the VM without deleting its files.
Note
When adding an existing VM to your configuration, make sure to declare any existing disks unless you want them detached.
Share a directory on the host with the VM:
programs.vmware-fusion.virtualMachines.asuna = {
# ...
sharedFolders.projects = {
hostPath = "/Users/asuna/projects";
readOnly = false;
};
};Each shared folder supports the following settings:
| Setting | Type | Default | Description |
|---|---|---|---|
hostPath |
String | — | Absolute path to the host directory (required) |
readOnly |
Boolean | false |
Whether the shared folder is read-only in the guest |
The attribute name (projects above) becomes the shared folder name reported
to the guest.
Configure the VM's display settings:
programs.vmware-fusion.virtualMachines.asuna.display = {
graphics = {
accelerate3D = true;
memory = 1024;
};
nativeDisplayResolution = {
enable = false;
scaledHighResolution = "all";
};
singleWindowFit = "inherit";
fullScreenFit = "inherit";
useAllDisplaysInFullScreen = false;
};The display configuration supports the following settings:
| Setting | Type | Default | Description |
|---|---|---|---|
graphics.accelerate3D |
Boolean | true |
Whether to enable accelerated 3D graphics |
graphics.memory |
Positive integer | 256 MiB |
Maximum VM memory available for graphics |
nativeDisplayResolution.enable |
Boolean | false |
Whether to render the guest using the host display's native pixel resolution |
nativeDisplayResolution.scaledHighResolution |
"full-screen", "single-window", or "all" |
"all" |
View modes that use scaled high resolution on non-Retina displays |
singleWindowFit |
"inherit", "stretch", or "resize" |
"inherit" |
How to size the virtual machine display in single-window mode |
fullScreenFit |
"inherit", "center", "stretch", or "resize" |
"inherit" |
How to size the virtual machine display in full-screen mode |
useAllDisplaysInFullScreen |
Boolean | false |
Whether to use all host displays in full-screen mode |
Removing display restores VMware Fusion's default behavior for these settings.
Attach a VMware HD Audio sound card to the VM:
programs.vmware-fusion.virtualMachines.asuna = {
# ...
sound = {
startConnected = true;
echoCancellation = false;
};
};The sound card uses the host's default audio input and output devices.
| Setting | Type | Default | Description |
|---|---|---|---|
startConnected |
Boolean | true |
Whether to connect the sound card when the virtual machine starts |
echoCancellation |
Boolean | false |
Whether to enable echo cancellation |
Removing sound from the configuration removes the sound card from the VM.
A virtual USB controller is attached to the VM by default. You can configure how new USB devices are handled:
programs.vmware-fusion.virtualMachines.asuna.usb = {
newDeviceAction = "ask";
};| Setting | Type | Default | Description |
|---|---|---|---|
newDeviceAction |
"ask", "connect-to-vm", or "connect-to-host" |
"ask" |
Action to take when a new USB device is connected to the host |
Setting usb to null removes the controller and disables USB device
passthrough.
Attach an ISO image to the VM with a virtual optical drive:
programs.vmware-fusion.virtualMachines.asuna = {
# ...
opticalDrives.installer = {
source = {
type = "image";
path = "/path/to/installer.iso";
};
startConnected = true;
};
};Each optical drive supports the following settings:
| Setting | Type | Default | Description |
|---|---|---|---|
source.type |
"image" |
— | Optical drive backing type (required) |
source.path |
String | — | Absolute path to the ISO image (required) |
startConnected |
Boolean | true |
Whether to connect the drive when the VM starts |
Optical drives can be updated by changing source or detached by removing
their declaration. The module only changes drives declared here or previously
managed by it.
Configure how content is shared between the host and guest:
programs.vmware-fusion.virtualMachines.asuna.isolation = {
clipboard = true;
dragAndDrop = true;
};| Setting | Type | Default | Description |
|---|---|---|---|
clipboard |
Boolean | true |
Whether to enable sharing clipboard contents between the host and guest |
dragAndDrop |
Boolean | true |
Whether to enable drag and drop between the host and guest |
By default, disabling the nix-darwin module does not remove VMware Fusion. To uninstall during activation when the module is disabled, set:
programs.vmware-fusion = {
enable = false;
onActivation.cleanup = "uninstall";
};You can also run the uninstaller directly:
NIXPKGS_ALLOW_UNFREE=1 nix run --impure github:pradyuman/nix-vmware-fusion -- uninstallThe uninstaller removes /Applications/VMware Fusion.app but leaves your
virtual machines, preferences, and privileged helpers in place.
Unlike uninstall (which only removes the app), purging also removes VMware Fusion's system support files, services, privileged helpers, and the selected user's preferences and logs. It does not touch any existing virtual machine bundles.
To purge during activation when the nix-darwin module is disabled, set:
system.primaryUser = "my-user";
programs.vmware-fusion = {
enable = false;
onActivation.cleanup = "purge";
};You can also run the command directly:
NIXPKGS_ALLOW_UNFREE=1 nix run --impure github:pradyuman/nix-vmware-fusion -- purgePurging also removes usbarb.rules if the VMware application support directory
contains no entries from other VMware programs.
Some files in VMware's app bundle store code-signature data in macOS extended attributes. Because the Nix archive format does not preserve those attributes, storing the extracted app directly in the Nix store would discard the signature data (which means strict code-signature verification would fail even though the files themselves were unchanged).
So instead, the flake stores the original DMG as an opaque file. At runtime, it
mounts the DMG and copies the app with ditto (which preserves the extended
attributes), and then verifies the copy before installing and initializing it.
The code in this repository is licensed under the ISC License. That license does not apply to VMware Fusion.
Broadcom currently makes the supported VMware Fusion release available at no charge for personal, educational, and commercial use. Nevertheless, VMware Fusion remains proprietary software. Downloading, installing, and using it is subject to Broadcom's applicable licensing terms, product-specific terms, and any conditions shown during download.