summaryrefslogtreecommitdiffstats
path: root/nixos/modules/virtualisation/vmware-guest.nix
diff options
context:
space:
mode:
authorJussi Maki <jussi.maki@vilea.ch>2015-05-13 08:31:32 +0000
committerJussi Maki <jussi.maki@vilea.ch>2015-05-15 12:43:21 +0200
commit6a0d21eb86105ac8e631621e9425eabbab3c0a1d (patch)
tree057dbf6cb32b4c2e80077dc09ecc449eb35babd2 /nixos/modules/virtualisation/vmware-guest.nix
parent75ebc3cf1dc1365be5a05018fc8e5409c66025cb (diff)
VMWare guest support and open-vm-tools package
Diffstat (limited to 'nixos/modules/virtualisation/vmware-guest.nix')
-rw-r--r--nixos/modules/virtualisation/vmware-guest.nix47
1 files changed, 47 insertions, 0 deletions
diff --git a/nixos/modules/virtualisation/vmware-guest.nix b/nixos/modules/virtualisation/vmware-guest.nix
new file mode 100644
index 000000000000..3f19f6a28b2b
--- /dev/null
+++ b/nixos/modules/virtualisation/vmware-guest.nix
@@ -0,0 +1,47 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.vmwareGuest;
+ open-vm-tools = pkgs.open-vm-tools;
+in
+{
+ options = {
+ services.vmwareGuest.enable = mkEnableOption "Enable VMWare Guest Support";
+ };
+
+ config = mkIf cfg.enable {
+ assertions = [ {
+ assertion = pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64;
+ message = "VMWare guest is not currently supported on ${pkgs.stdenv.system}";
+ } ];
+
+ environment.systemPackages = [ open-vm-tools ];
+
+ systemd.services.vmware =
+ { description = "VMWare Guest Service";
+ wantedBy = [ "multi-user.target" ];
+ serviceConfig.ExecStart = "${open-vm-tools}/bin/vmtoolsd";
+ };
+
+ services.xserver = {
+ videoDrivers = mkOverride 50 [ "vmware" ];
+
+ config = ''
+ Section "InputDevice"
+ Identifier "VMMouse"
+ Driver "vmmouse"
+ EndSection
+ '';
+
+ serverLayoutSection = ''
+ InputDevice "VMMouse"
+ '';
+
+ displayManager.sessionCommands = ''
+ ${open-vm-tools}/bin/vmware-user-suid-wrapper
+ '';
+ };
+ };
+}