From 7568d3cb493a37a13a8c307814985314fcbd9cbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Mon, 28 Jul 2025 15:19:24 +0200 Subject: [PATCH 1/4] open-vm-tools: convert sed to substituteInPlace --replace-fail --- pkgs/by-name/op/open-vm-tools/package.nix | 31 +++++++++++++---------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/pkgs/by-name/op/open-vm-tools/package.nix b/pkgs/by-name/op/open-vm-tools/package.nix index d038aa0f1ced..626934935e04 100644 --- a/pkgs/by-name/op/open-vm-tools/package.nix +++ b/pkgs/by-name/op/open-vm-tools/package.nix @@ -107,26 +107,29 @@ stdenv.mkDerivation (finalAttrs: { ]; postPatch = '' - sed -i Makefile.am \ - -e 's,etc/vmware-tools,''${prefix}/etc/vmware-tools,' - sed -i scripts/Makefile.am \ - -e 's,^confdir = ,confdir = ''${prefix},' \ - -e 's,usr/bin,''${prefix}/usr/bin,' - sed -i services/vmtoolsd/Makefile.am \ - -e 's,etc/vmware-tools,''${prefix}/etc/vmware-tools,' \ - -e 's,$(PAM_PREFIX),''${prefix}/$(PAM_PREFIX),' - sed -i vgauth/service/Makefile.am \ - -e 's,/etc/vmware-tools/vgauth/schemas,''${prefix}/etc/vmware-tools/vgauth/schemas,' \ - -e 's,$(DESTDIR)/etc/vmware-tools/vgauth.conf,''${prefix}/etc/vmware-tools/vgauth.conf,' + substituteInPlace Makefile.am \ + --replace-fail "etc/vmware-tools" "''${prefix}/etc/vmware-tools" + substituteInPlace scripts/Makefile.am \ + --replace-fail "confdir = /etc/vmware-tools" "confdir = ''${prefix}/etc/vmware-tools" \ + --replace-fail "/usr/bin" "''${prefix}/usr/bin" + substituteInPlace services/vmtoolsd/Makefile.am \ + --replace-fail "etc/vmware-tools" "''${prefix}/etc/vmware-tools" \ + --replace-fail "\$(PAM_PREFIX)" "''${prefix}/\$(PAM_PREFIX)" + substituteInPlace vgauth/service/Makefile.am \ + --replace-fail "/etc/vmware-tools/vgauth/schemas" "''${prefix}/etc/vmware-tools/vgauth/schemas" \ + --replace-fail "\$(DESTDIR)/etc/vmware-tools/vgauth.conf" "''${prefix}/etc/vmware-tools/vgauth.conf" # don't abort on any warning - sed -i 's,CFLAGS="$CFLAGS -Werror",,' configure.ac + substituteInPlace configure.ac \ + --replace-fail 'CFLAGS="$CFLAGS -Werror"' "" # Make reboot work, shutdown is not in /sbin on NixOS - sed -i 's,/sbin/shutdown,shutdown,' lib/system/systemLinux.c + substituteInPlace lib/system/systemLinux.c \ + --replace-fail "/sbin/shutdown" "shutdown" # Fix paths to fuse3 (we do not use fuse2 so that is not modified) - sed -i 's,/bin/fusermount3,${fuse3}/bin/fusermount3,' vmhgfs-fuse/config.c + substituteInPlace vmhgfs-fuse/config.c \ + --replace-fail "/bin/fusermount3" "${fuse3}/bin/fusermount3" substituteInPlace services/plugins/vix/foundryToolsDaemon.c \ --replace-fail "/usr/bin/vmhgfs-fuse" "${placeholder "out"}/bin/vmhgfs-fuse" \ From d99faf6a26163fce2646aef7fe0988b540cc2830 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Mon, 28 Jul 2025 15:20:39 +0200 Subject: [PATCH 2/4] open-vm-tools: fix dlopen path to libguestStoreClient.so.0 Jul 28 14:52:27 krypton vmsvc[733]: [critical] [guestStoreClient] [733] GuestStoreGetLibExportFunctions: dlopen failed: libguestStoreClient.so.0: cannot open shared object file: No such file or directory --- pkgs/by-name/op/open-vm-tools/package.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/by-name/op/open-vm-tools/package.nix b/pkgs/by-name/op/open-vm-tools/package.nix index 626934935e04..64cd802b6c33 100644 --- a/pkgs/by-name/op/open-vm-tools/package.nix +++ b/pkgs/by-name/op/open-vm-tools/package.nix @@ -134,6 +134,9 @@ stdenv.mkDerivation (finalAttrs: { substituteInPlace services/plugins/vix/foundryToolsDaemon.c \ --replace-fail "/usr/bin/vmhgfs-fuse" "${placeholder "out"}/bin/vmhgfs-fuse" \ --replace-fail "/bin/mount" "${util-linux}/bin/mount" + + substituteInPlace lib/guestStoreClientHelper/guestStoreClient.c \ + --replace-fail "libguestStoreClient.so.0" "$out/lib/libguestStoreClient.so.0" ''; configureFlags = [ From eafd3478090b325150fac22f775def127904bae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Mon, 28 Jul 2025 15:55:19 +0200 Subject: [PATCH 3/4] open-vm-tools: move patching to postPatch --- pkgs/by-name/op/open-vm-tools/package.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/op/open-vm-tools/package.nix b/pkgs/by-name/op/open-vm-tools/package.nix index 64cd802b6c33..c4774f371a8f 100644 --- a/pkgs/by-name/op/open-vm-tools/package.nix +++ b/pkgs/by-name/op/open-vm-tools/package.nix @@ -137,6 +137,9 @@ stdenv.mkDerivation (finalAttrs: { substituteInPlace lib/guestStoreClientHelper/guestStoreClient.c \ --replace-fail "libguestStoreClient.so.0" "$out/lib/libguestStoreClient.so.0" + + substituteInPlace udev/99-vmware-scsi-udev.rules \ + --replace-fail "/bin/sh" "${bash}/bin/sh" ''; configureFlags = [ @@ -164,7 +167,7 @@ stdenv.mkDerivation (finalAttrs: { which ] }" - substituteInPlace "$out/lib/udev/rules.d/99-vmware-scsi-udev.rules" --replace-fail "/bin/sh" "${bash}/bin/sh" + ''; meta = { From f8218b54bda70ec1151b766bc2c6165458136625 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Mon, 28 Jul 2025 15:19:41 +0200 Subject: [PATCH 4/4] open-vm-tools: move vm-support binary to $out/bin and fix missing tools --- pkgs/by-name/op/open-vm-tools/package.nix | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/op/open-vm-tools/package.nix b/pkgs/by-name/op/open-vm-tools/package.nix index c4774f371a8f..8cd5040ace23 100644 --- a/pkgs/by-name/op/open-vm-tools/package.nix +++ b/pkgs/by-name/op/open-vm-tools/package.nix @@ -12,6 +12,7 @@ xercesc, icu, libdnet, + pciutils, procps, libtirpc, rpcsvc-proto, @@ -111,7 +112,7 @@ stdenv.mkDerivation (finalAttrs: { --replace-fail "etc/vmware-tools" "''${prefix}/etc/vmware-tools" substituteInPlace scripts/Makefile.am \ --replace-fail "confdir = /etc/vmware-tools" "confdir = ''${prefix}/etc/vmware-tools" \ - --replace-fail "/usr/bin" "''${prefix}/usr/bin" + --replace-fail "/usr/bin" "''${prefix}/bin" substituteInPlace services/vmtoolsd/Makefile.am \ --replace-fail "etc/vmware-tools" "''${prefix}/etc/vmware-tools" \ --replace-fail "\$(PAM_PREFIX)" "''${prefix}/\$(PAM_PREFIX)" @@ -131,6 +132,12 @@ stdenv.mkDerivation (finalAttrs: { substituteInPlace vmhgfs-fuse/config.c \ --replace-fail "/bin/fusermount3" "${fuse3}/bin/fusermount3" + # do not break the PATHs set by makeWrapper, sudo resets PATH anyway. + substituteInPlace scripts/common/vm-support \ + --replace-fail "export PATH=/bin:/sbin:/usr/bin:/usr/sbin" "" \ + --replace-fail ". /etc/profile" ":" \ + --replace-fail "/sbin/lsmod" "lsmod" + substituteInPlace services/plugins/vix/foundryToolsDaemon.c \ --replace-fail "/usr/bin/vmhgfs-fuse" "${placeholder "out"}/bin/vmhgfs-fuse" \ --replace-fail "/bin/mount" "${util-linux}/bin/mount" @@ -158,6 +165,16 @@ stdenv.mkDerivation (finalAttrs: { ''; postInstall = '' + wrapProgram "$out/bin/vm-support" \ + --prefix PATH ':' "${ + makeBinPath [ + iproute2 + pciutils # for lspci + systemd + which + ] + }" + wrapProgram "$out/etc/vmware-tools/scripts/vmware/network" \ --prefix PATH ':' "${ makeBinPath [ @@ -167,7 +184,6 @@ stdenv.mkDerivation (finalAttrs: { which ] }" - ''; meta = {