1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let 6 cfg = config.services.vmwareGuest; 7 open-vm-tools = pkgs.open-vm-tools; 8in 9{ 10 options = { 11 services.vmwareGuest.enable = mkEnableOption "VMWare Guest Support"; 12 }; 13 14 config = mkIf cfg.enable { 15 assertions = [ { 16 assertion = pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64; 17 message = "VMWare guest is not currently supported on ${pkgs.stdenv.system}"; 18 } ]; 19 20 environment.systemPackages = [ open-vm-tools ]; 21 22 systemd.services.vmware = 23 { description = "VMWare Guest Service"; 24 wantedBy = [ "multi-user.target" ]; 25 serviceConfig.ExecStart = "${open-vm-tools}/bin/vmtoolsd"; 26 }; 27 28 services.xserver = { 29 videoDrivers = mkOverride 50 [ "vmware" ]; 30 31 config = '' 32 Section "InputDevice" 33 Identifier "VMMouse" 34 Driver "vmmouse" 35 EndSection 36 ''; 37 38 serverLayoutSection = '' 39 InputDevice "VMMouse" 40 ''; 41 42 displayManager.sessionCommands = '' 43 ${open-vm-tools}/bin/vmware-user-suid-wrapper 44 ''; 45 }; 46 }; 47}