at 16.09-beta 1.2 kB view raw
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 environment.etc."vmware-tools".source = "${pkgs.open-vm-tools}/etc/vmware-tools/*"; 29 30 services.xserver = { 31 videoDrivers = mkOverride 50 [ "vmware" ]; 32 33 config = '' 34 Section "InputDevice" 35 Identifier "VMMouse" 36 Driver "vmmouse" 37 EndSection 38 ''; 39 40 serverLayoutSection = '' 41 InputDevice "VMMouse" 42 ''; 43 44 displayManager.sessionCommands = '' 45 ${open-vm-tools}/bin/vmware-user-suid-wrapper 46 ''; 47 }; 48 }; 49}