From a14ef4ad5270a5ee51bdc28d405854ec69d18149 Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Thu, 1 Dec 2016 16:59:53 +0200 Subject: [PATCH] open-vm-tools: 10.0.7 -> 10.1.0 Also add an option to disable all the X11 stuff. --- nixos/modules/virtualisation/vmware-guest.nix | 13 +++-- .../virtualization/open-vm-tools/default.nix | 50 +++++++++++-------- .../open-vm-tools/recognize_nixos.patch | 46 +++++++---------- pkgs/top-level/all-packages.nix | 1 + 4 files changed, 57 insertions(+), 53 deletions(-) diff --git a/nixos/modules/virtualisation/vmware-guest.nix b/nixos/modules/virtualisation/vmware-guest.nix index ac5f87817fe..ce1224a8f13 100644 --- a/nixos/modules/virtualisation/vmware-guest.nix +++ b/nixos/modules/virtualisation/vmware-guest.nix @@ -4,12 +4,19 @@ with lib; let cfg = config.services.vmwareGuest; - open-vm-tools = pkgs.open-vm-tools; + open-vm-tools = if cfg.headless then pkgs.open-vm-tools-headless else pkgs.open-vm-tools; xf86inputvmmouse = pkgs.xorg.xf86inputvmmouse; in { options = { - services.vmwareGuest.enable = mkEnableOption "VMWare Guest Support"; + services.vmwareGuest = { + enable = mkEnableOption "VMWare Guest Support"; + headless = mkOption { + type = types.bool; + default = false; + description = "Whether to disable X11-related features."; + }; + }; }; config = mkIf cfg.enable { @@ -28,7 +35,7 @@ in environment.etc."vmware-tools".source = "${pkgs.open-vm-tools}/etc/vmware-tools/*"; - services.xserver = { + services.xserver = mkIf (!cfg.headless) { videoDrivers = mkOverride 50 [ "vmware" ]; modules = [ xf86inputvmmouse ]; diff --git a/pkgs/applications/virtualization/open-vm-tools/default.nix b/pkgs/applications/virtualization/open-vm-tools/default.nix index dd8ddfd0e0b..78fa090f925 100644 --- a/pkgs/applications/virtualization/open-vm-tools/default.nix +++ b/pkgs/applications/virtualization/open-vm-tools/default.nix @@ -1,42 +1,48 @@ { stdenv, lib, fetchFromGitHub, makeWrapper, autoreconfHook, - libmspack, openssl, pam, xercesc, icu, libdnet, procps, - xlibsWrapper, libXinerama, libXi, libXrender, libXrandr, libXtst, - pkgconfig, glib, gtk, gtkmm, iproute, dbus, systemd }: + fuse, libmspack, openssl, pam, xercesc, icu, libdnet, procps, + libX11, libXext, libXinerama, libXi, libXrender, libXrandr, libXtst, + pkgconfig, glib, gtk, gtkmm, iproute, dbus, systemd, which, + withX ? true }: -let - majorVersion = "10.0"; - minorVersion = "7"; - version = "${majorVersion}.${minorVersion}"; - -in stdenv.mkDerivation rec { +stdenv.mkDerivation rec { name = "open-vm-tools-${version}"; + version = "10.1.0"; + src = fetchFromGitHub { owner = "vmware"; repo = "open-vm-tools"; rev = "stable-${version}"; - sha256 = "0xxgppxjisg3jly21r7mjk06rc4n7ssyvapasxhbi2d1bw0xkvrj"; + sha256 = "1qzk4mvw618ca4j9agsfpqch9jgwghvdc4rpkvlyz8kirvh9iniz"; }; sourceRoot = "${src.name}/open-vm-tools"; - buildInputs = - [ autoreconfHook makeWrapper libmspack openssl pam xercesc icu libdnet procps - pkgconfig glib gtk gtkmm xlibsWrapper libXinerama libXi libXrender libXrandr libXtst ]; + outputs = [ "out" "dev" ]; - postPatch = '' - sed -i s,-Werror,,g configure.ac - sed -i 's,^confdir = ,confdir = ''${prefix},' scripts/Makefile.am - sed -i 's,etc/vmware-tools,''${prefix}/etc/vmware-tools,' services/vmtoolsd/Makefile.am - ''; + nativeBuildInputs = [ autoreconfHook makeWrapper pkgconfig ]; + buildInputs = [ fuse glib icu libdnet libmspack openssl pam procps xercesc ] + ++ lib.optionals withX [ gtk gtkmm libX11 libXext libXinerama libXi libXrender libXrandr libXtst ]; patches = [ ./recognize_nixos.patch ]; + postPatch = '' + # Build bugfix for 10.1.0, stolen from Arch PKGBUILD + mkdir -p common-agent/etc/config + sed -i 's|.*common-agent/etc/config/Makefile.*|\\|' configure.ac - configureFlags = "--without-kernel-modules --without-xmlsecurity"; + sed -i 's,^confdir = ,confdir = ''${prefix},' scripts/Makefile.am + sed -i 's,etc/vmware-tools,''${prefix}/etc/vmware-tools,' services/vmtoolsd/Makefile.am + sed -i 's,$(PAM_PREFIX),''${prefix}/$(PAM_PREFIX),' services/vmtoolsd/Makefile.am + sed -i 's,$(UDEVRULESDIR),''${prefix}/$(UDEVRULESDIR),' udev/Makefile.am + ''; + + configureFlags = [ "--without-kernel-modules" "--without-xmlsecurity" ] + ++ lib.optional (!withX) "--without-x"; + + enableParallelBuilding = true; postInstall = '' - sed -i 's,which ,command -v ,' "$out/etc/vmware-tools/scripts/vmware/network" - wrapProgram "$out/etc/vmware-tools/scripts/vmware/network" \ - --prefix PATH ':' "${lib.makeBinPath [ iproute dbus systemd ]}" + wrapProgram "$out/etc/vmware-tools/scripts/vmware/network" \ + --prefix PATH ':' "${lib.makeBinPath [ iproute dbus systemd which ]}" ''; meta = with stdenv.lib; { diff --git a/pkgs/applications/virtualization/open-vm-tools/recognize_nixos.patch b/pkgs/applications/virtualization/open-vm-tools/recognize_nixos.patch index 64991a152bc..46d8ea7f7f3 100644 --- a/pkgs/applications/virtualization/open-vm-tools/recognize_nixos.patch +++ b/pkgs/applications/virtualization/open-vm-tools/recognize_nixos.patch @@ -1,30 +1,20 @@ -diff -ruN open-vm-tools.orig/lib/include/guest_os.h open-vm-tools/lib/include/guest_os.h ---- open-vm-tools.orig/lib/include/guest_os.h 2016-02-12 00:50:33.000000000 +0000 -+++ open-vm-tools/lib/include/guest_os.h 2016-04-18 20:07:41.677251511 +0000 -@@ -222,6 +222,7 @@ +diff --git a/lib/include/guest_os.h b/open-vm-tools/lib/include/guest_os.h +index ef202e3..c7a105d 100644 +--- a/lib/include/guest_os.h ++++ b/lib/include/guest_os.h +@@ -238,6 +238,7 @@ Bool Gos_InSetArray(uint32 gos, const uint32 *set); #define STR_OS_MANDRAKE_FULL "Mandrake Linux" #define STR_OS_MANDRIVA "mandriva" #define STR_OS_MKLINUX "MkLinux" +#define STR_OS_NIXOS "NixOS" #define STR_OS_NOVELL "nld9" #define STR_OS_NOVELL_FULL "Novell Linux Desktop 9" - #define STR_OS_ORACLE "oraclelinux" -diff -ruN open-vm-tools.orig/lib/include/vmblock.h open-vm-tools/lib/include/vmblock.h ---- open-vm-tools.orig/lib/include/vmblock.h 2016-02-12 00:50:33.000000000 +0000 -+++ open-vm-tools/lib/include/vmblock.h 2016-04-18 21:51:15.651235848 +0000 -@@ -145,7 +145,7 @@ - # define VMBLOCK_DEVICE_MODE VMBLOCK_FUSE_DEVICE_MODE - # define VMBLOCK_MOUNT_POINT VMBLOCK_FUSE_MOUNT_POINT - --#elif defined(linux) -+#elif defined(__linux__) - # define VMBLOCK_ADD_FILEBLOCK 98 - # define VMBLOCK_DEL_FILEBLOCK 99 - # ifdef VMX86_DEVEL -diff -ruN open-vm-tools.orig/lib/misc/hostinfoPosix.c open-vm-tools/lib/misc/hostinfoPosix.c ---- open-vm-tools.orig/lib/misc/hostinfoPosix.c 2016-02-12 00:50:33.000000000 +0000 -+++ open-vm-tools/lib/misc/hostinfoPosix.c 2016-04-18 20:09:45.841668252 +0000 -@@ -195,6 +195,7 @@ + #define STR_OS_ORACLE6 "oraclelinux6" +diff --git a/lib/misc/hostinfoPosix.c b/open-vm-tools/lib/misc/hostinfoPosix.c +index 0f55070..2d8467c 100644 +--- a/lib/misc/hostinfoPosix.c ++++ b/lib/misc/hostinfoPosix.c +@@ -195,6 +195,7 @@ static const DistroInfo distroArray[] = { {"Mandrake", "/etc/mandrake-release"}, {"Mandriva", "/etc/mandriva-release"}, {"MkLinux", "/etc/mklinux-release"}, @@ -32,12 +22,12 @@ diff -ruN open-vm-tools.orig/lib/misc/hostinfoPosix.c open-vm-tools/lib/misc/hos {"Novell", "/etc/nld-release"}, {"OracleLinux", "/etc/oracle-release"}, {"Photon", "/etc/lsb-release"}, -@@ -619,6 +620,8 @@ - Str_Strcpy(distroShort, STR_OS_MANDRIVA, distroShortSize); - } else if (strstr(distroLower, "mklinux")) { - Str_Strcpy(distroShort, STR_OS_MKLINUX, distroShortSize); +@@ -554,6 +555,8 @@ HostinfoGetOSShortName(char *distro, // IN: full distro name + } + } else if (strstr(distroLower, "mandrake")) { + Str_Strcpy(distroShort, STR_OS_MANDRAKE, distroShortSize); + } else if (strstr(distroLower, "nixos")) { + Str_Strcpy(distroShort, STR_OS_NIXOS, distroShortSize); - } else if (strstr(distroLower, "pld")) { - Str_Strcpy(distroShort, STR_OS_PLD, distroShortSize); - } else if (strstr(distroLower, "slackware")) { + } else if (strstr(distroLower, "turbolinux")) { + Str_Strcpy(distroShort, STR_OS_TURBO, distroShortSize); + } else if (strstr(distroLower, "sun")) { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b06f761ea90..f1038dade74 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -11606,6 +11606,7 @@ with pkgs; open-vm-tools = callPackage ../applications/virtualization/open-vm-tools { inherit (gnome2) gtk gtkmm; }; + open-vm-tools-headless = open-vm-tools.override { withX = false; }; delve = callPackage ../development/tools/delve { };