vmware-horizon-client: various tweaks

This commit is contained in:
Sean Buckley 2021-11-29 16:56:56 -05:00
parent 12318bfcfe
commit 2309d875dd

View file

@ -1,42 +1,12 @@
{ stdenv { stdenv
, lib , lib
, at-spi2-atk
, atk
, buildFHSUserEnv , buildFHSUserEnv
, cairo
, dbus
, fetchurl , fetchurl
, fontconfig
, freetype
, gdk-pixbuf
, glib
, gsettings-desktop-schemas , gsettings-desktop-schemas
, gtk2
, gtk3-x11
, harfbuzz
, liberation_ttf
, libjpeg
, libtiff
, libudev0-shim
, libuuid
, libX11
, libXcursor
, libXext
, libXi
, libXinerama
, libxkbfile
, libxml2
, libXrandr
, libXrender
, libXScrnSaver
, libxslt
, libXtst
, makeDesktopItem , makeDesktopItem
, makeWrapper , makeWrapper
, pango , writeTextDir
, pcsclite , configText ? ""
, pixman
, zlib
}: }:
let let
version = "2106.1"; version = "2106.1";
@ -46,6 +16,19 @@ let
else throw "Unsupported system: ${stdenv.hostPlatform.system}"; else throw "Unsupported system: ${stdenv.hostPlatform.system}";
# The downloaded archive also contains ARM binaries, but these have not been tested. # The downloaded archive also contains ARM binaries, but these have not been tested.
# For USB support, ensure that /var/run/vmware/<YOUR-UID>
# exists and is owned by you. Then run vmware-usbarbitrator as root.
bins = [ "vmware-view" "vmware-usbarbitrator" ];
# This forces the default GTK theme (Adwaita) because Horizon is prone to
# UI usability issues when using non-default themes, such as Adwaita-dark.
wrapBinCommands = name: ''
makeWrapper "$out/bin/${name}" "$out/bin/${name}_wrapper" \
--set GTK_THEME Adwaita \
--suffix XDG_DATA_DIRS : "${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}" \
--suffix LD_LIBRARY_PATH : "$out/lib/vmware/view/crtbora:$out/lib/vmware"
'';
vmwareHorizonClientFiles = stdenv.mkDerivation { vmwareHorizonClientFiles = stdenv.mkDerivation {
name = "vmwareHorizonClientFiles"; name = "vmwareHorizonClientFiles";
inherit version; inherit version;
@ -71,21 +54,16 @@ let
# This library causes the program to core-dump occasionally. Use ours instead. # This library causes the program to core-dump occasionally. Use ours instead.
rm $out/lib/vmware/view/crtbora/libcairo.* rm $out/lib/vmware/view/crtbora/libcairo.*
# Force the default GTK theme (Adwaita) because Horizon is prone to ${lib.concatMapStrings wrapBinCommands bins}
# UI usability issues when using non-default themes, such as Adwaita-dark.
makeWrapper "$out/bin/vmware-view" "$out/bin/vmware-view_wrapper" \
--set GTK_THEME Adwaita \
--suffix XDG_DATA_DIRS : "${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}" \
--suffix LD_LIBRARY_PATH : "$out/lib/vmware/view/crtbora:$out/lib/vmware"
''; '';
}; };
vmwareFHSUserEnv = buildFHSUserEnv { vmwareFHSUserEnv = name: buildFHSUserEnv {
name = "vmware-view"; inherit name;
runScript = "${vmwareHorizonClientFiles}/bin/vmware-view_wrapper"; runScript = "${vmwareHorizonClientFiles}/bin/${name}_wrapper";
targetPkgs = pkgs: [ targetPkgs = pkgs: with pkgs; [
at-spi2-atk at-spi2-atk
atk atk
cairo cairo
@ -99,25 +77,29 @@ let
harfbuzz harfbuzz
liberation_ttf liberation_ttf
libjpeg libjpeg
libpulseaudio
libtiff libtiff
libudev0-shim libudev0-shim
libuuid libuuid
libX11 libv4l
libXcursor
libXext
libXi
libXinerama
libxkbfile
libxml2 libxml2
libXrandr
libXrender
libXScrnSaver
libXtst
pango pango
pcsclite pcsclite
pixman pixman
vmwareHorizonClientFiles vmwareHorizonClientFiles
xorg.libX11
xorg.libXcursor
xorg.libXext
xorg.libXi
xorg.libXinerama
xorg.libxkbfile
xorg.libXrandr
xorg.libXrender
xorg.libXScrnSaver
xorg.libXtst
zlib zlib
(writeTextDir "etc/vmware/config" configText)
]; ];
}; };
@ -125,20 +107,25 @@ let
name = "vmware-view"; name = "vmware-view";
desktopName = "VMware Horizon Client"; desktopName = "VMware Horizon Client";
icon = "${vmwareHorizonClientFiles}/share/icons/vmware-view.png"; icon = "${vmwareHorizonClientFiles}/share/icons/vmware-view.png";
exec = "${vmwareFHSUserEnv}/bin/vmware-view %u"; exec = "${vmwareFHSUserEnv "vmware-view"}/bin/vmware-view %u";
mimeType = "x-scheme-handler/vmware-view"; mimeType = "x-scheme-handler/vmware-view";
}; };
binLinkCommands = lib.concatMapStringsSep
"\n"
(bin: "ln -s ${vmwareFHSUserEnv bin}/bin/${bin} $out/bin/")
bins;
in in
stdenv.mkDerivation { stdenv.mkDerivation {
name = "vmware-view"; name = "vmware-horizon-client";
dontUnpack = true; dontUnpack = true;
installPhase = '' installPhase = ''
mkdir -p $out/bin $out/share/applications mkdir -p $out/bin $out/share/applications
cp "${desktopItem}"/share/applications/* $out/share/applications/ cp ${desktopItem}/share/applications/* $out/share/applications/
ln -s "${vmwareFHSUserEnv}/bin/vmware-view" "$out/bin/" ${binLinkCommands}
''; '';
unwrapped = vmwareHorizonClientFiles; unwrapped = vmwareHorizonClientFiles;
@ -146,10 +133,11 @@ stdenv.mkDerivation {
passthru.updateScript = ./update.sh; passthru.updateScript = ./update.sh;
meta = with lib; { meta = with lib; {
mainProgram = "vmware-view";
description = "Allows you to connect to your VMware Horizon virtual desktop"; description = "Allows you to connect to your VMware Horizon virtual desktop";
homepage = "https://www.vmware.com/go/viewclients"; homepage = "https://www.vmware.com/go/viewclients";
license = licenses.unfree; license = licenses.unfree;
platforms = platforms.linux; platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ buckley310 ]; maintainers = with maintainers; [ buckley310 ];
}; };
} }