about summary refs log tree commit diff
path: root/pkgs/applications/networking/remote
diff options
context:
space:
mode:
authorRaymond Gauthier <jraygauthier@gmail.com>2021-10-12 10:35:35 -0400
committerRaymond Gauthier <jraygauthier@gmail.com>2021-10-12 10:35:35 -0400
commitc55bc5bfd3377d54f5b6153d09c033cceadfcc05 (patch)
tree1bcf152599a04ee113dd050e537b568fa57609b0 /pkgs/applications/networking/remote
parentdb889eb9137a859eedfc5b402de84271c0659662 (diff)
teamviewer: refactor executable wrapping
This centralizes `PATH` and `LD_LIBRARY_PATH`, avoid multiple
layers of wrappers.

Refactor as suggested by @Artturin in PR provided patch:
<https://github.com/NixOS/nixpkgs/pull/140076#issuecomment-934770391>.
Diffstat (limited to 'pkgs/applications/networking/remote')
-rw-r--r--pkgs/applications/networking/remote/teamviewer/default.nix24
1 files changed, 12 insertions, 12 deletions
diff --git a/pkgs/applications/networking/remote/teamviewer/default.nix b/pkgs/applications/networking/remote/teamviewer/default.nix
index 17e7bdaf1a918..266a80e19e59e 100644
--- a/pkgs/applications/networking/remote/teamviewer/default.nix
+++ b/pkgs/applications/networking/remote/teamviewer/default.nix
@@ -72,19 +72,19 @@ mkDerivation rec {
       --replace '/lib64/ld-linux-x86-64.so.2' '${glibc.out}/lib/ld-linux-x86-64.so.2'
     substituteInPlace $out/share/teamviewer/tv_bin/script/tvw_config \
       --replace '/var/run/' '/run/'
+  '';
 
-    wrapProgram $out/share/teamviewer/tv_bin/script/teamviewer \
-      --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ libXrandr libX11 dbus ]}"
-    wrapProgram $out/share/teamviewer/tv_bin/teamviewerd \
-      --prefix PATH : "${lib.makeBinPath [ getconf ]}" \
-      --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ libXrandr libX11 dbus ]}"
-    wrapProgram $out/share/teamviewer/tv_bin/TeamViewer \
-      --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ libXrandr libX11 dbus ]}"
-    wrapProgram $out/share/teamviewer/tv_bin/TeamViewer_Desktop \
-      --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [libXrandr libX11 libXext libXdamage libXtst libSM libXfixes dbus ]}"
-
-    wrapQtApp $out/share/teamviewer/tv_bin/script/teamviewer
-    wrapQtApp $out/bin/teamviewer
+  makeWrapperArgs = [
+    "--prefix PATH : ${lib.makeBinPath [ getconf ]}"
+    "--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ libXrandr libX11 libXext libXdamage libXtst libSM libXfixes dbus ]}"
+  ];
+
+  postFixup = ''
+    wrapProgram $out/share/teamviewer/tv_bin/teamviewerd ''${makeWrapperArgs[@]}
+    # tv_bin/script/teamviewer runs tvw_main which runs tv_bin/TeamViewer
+    wrapProgram $out/share/teamviewer/tv_bin/script/teamviewer ''${makeWrapperArgs[@]} ''${qtWrapperArgs[@]}
+    wrapProgram $out/share/teamviewer/tv_bin/teamviewer-config ''${makeWrapperArgs[@]} ''${qtWrapperArgs[@]}
+    wrapProgram $out/share/teamviewer/tv_bin/TeamViewer_Desktop ''${makeWrapperArgs[@]} ''${qtWrapperArgs[@]}
   '';
 
   dontStrip = true;