2015-11-08 19:39:57 +00:00
|
|
|
{ stdenv
|
2017-10-23 17:53:11 +01:00
|
|
|
, lib
|
2018-06-29 21:24:04 +01:00
|
|
|
, fetchurl
|
2015-11-08 19:39:57 +00:00
|
|
|
, requireFile
|
|
|
|
, makeWrapper
|
|
|
|
, libredirect
|
|
|
|
, busybox
|
|
|
|
, file
|
|
|
|
, makeDesktopItem
|
|
|
|
, tzdata
|
|
|
|
, cacert
|
|
|
|
, glib
|
2016-09-11 22:24:51 +01:00
|
|
|
, gtk2
|
2015-11-08 19:39:57 +00:00
|
|
|
, atk
|
|
|
|
, gdk_pixbuf
|
|
|
|
, cairo
|
|
|
|
, pango
|
|
|
|
, gnome3
|
2018-03-13 10:16:03 +00:00
|
|
|
, xorg
|
2015-11-08 19:39:57 +00:00
|
|
|
, libpng12
|
|
|
|
, freetype
|
|
|
|
, fontconfig
|
|
|
|
, gtk_engines
|
|
|
|
, alsaLib
|
2017-10-02 20:29:33 +01:00
|
|
|
, libidn
|
|
|
|
, zlib
|
2018-06-29 21:26:24 +01:00
|
|
|
, version ? "13.10.0"
|
2015-11-08 19:39:57 +00:00
|
|
|
}:
|
|
|
|
|
2017-10-23 17:53:11 +01:00
|
|
|
let
|
2018-06-29 21:24:04 +01:00
|
|
|
# In 56e1bdc7f9c (libidn: 1.34 -> 1.35), libidn.so.11 became libidn.so.12.
|
|
|
|
# Citrix looks for the former so we build version 1.34 to please the binary
|
|
|
|
libidn_134 = libidn.overrideDerivation (_: rec {
|
|
|
|
name = "libidn-1.34";
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://gnu/libidn/${name}.tar.gz";
|
|
|
|
sha256 = "0g3fzypp0xjcgr90c5cyj57apx1cmy0c6y9lvw2qdcigbyby469p";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2019-03-11 14:36:57 +00:00
|
|
|
versionInfo = let
|
|
|
|
supportedVersions = {
|
|
|
|
"13.10.0" = {
|
|
|
|
major = "13";
|
|
|
|
minor = "10";
|
|
|
|
patch = "0";
|
|
|
|
x64hash = "7025688C7891374CDA11C92FC0BA2FA8151AEB4C4D31589AD18747FAE943F6EA";
|
|
|
|
x86hash = "2DCA3C8EDED11C5D824D579BC3A6B7D531EAEDDCBFB16E91B5702C72CAE9DEE4";
|
|
|
|
x64suffix = "20";
|
|
|
|
x86suffix = "20";
|
|
|
|
homepage = https://www.citrix.com/downloads/citrix-receiver/linux/receiver-for-linux-latest.html;
|
|
|
|
};
|
2018-03-08 19:15:30 +00:00
|
|
|
};
|
|
|
|
|
2019-03-11 14:36:57 +00:00
|
|
|
# break an evaluation for old Citrix versions rather than exiting with
|
|
|
|
# an "attribute name not found" error to avoid confusion.
|
|
|
|
deprecatedVersions = let
|
|
|
|
versions = [ "13.8.0" "13.9.0" "13.9.1" ];
|
|
|
|
in
|
|
|
|
lib.listToAttrs
|
|
|
|
(lib.flip map versions
|
|
|
|
(v: lib.nameValuePair v (throw "Unsupported citrix_receiver version: ${v}")));
|
|
|
|
in
|
|
|
|
deprecatedVersions // supportedVersions;
|
2015-11-08 19:39:57 +00:00
|
|
|
|
2017-10-23 17:53:11 +01:00
|
|
|
citrixReceiverForVersion = { major, minor, patch, x86hash, x64hash, x86suffix, x64suffix, homepage }:
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "citrix-receiver-${version}";
|
|
|
|
version = "${major}.${minor}.${patch}";
|
|
|
|
inherit homepage;
|
|
|
|
|
|
|
|
prefixWithBitness = if stdenv.is64bit then "linuxx64" else "linuxx86";
|
|
|
|
|
|
|
|
src = requireFile rec {
|
|
|
|
name = if stdenv.is64bit then "${prefixWithBitness}-${version}.${x64suffix}.tar.gz" else "${prefixWithBitness}-${version}.${x86suffix}.tar.gz";
|
|
|
|
sha256 = if stdenv.is64bit then x64hash else x86hash;
|
|
|
|
message = ''
|
|
|
|
In order to use Citrix Receiver, you need to comply with the Citrix EULA and download
|
|
|
|
the ${if stdenv.is64bit then "64-bit" else "32-bit"} binaries, .tar.gz from:
|
|
|
|
|
|
|
|
${homepage}
|
|
|
|
|
|
|
|
(if you do not find version ${version} there, try at
|
|
|
|
https://www.citrix.com/downloads/citrix-receiver/legacy-receiver-for-linux/
|
|
|
|
or at https://www.citrix.com/downloads/citrix-receiver/ under "Earlier Versions of Receiver for Linux")
|
|
|
|
|
|
|
|
Once you have downloaded the file, please use the following command and re-run the
|
|
|
|
installation:
|
|
|
|
|
|
|
|
nix-prefetch-url file://\$PWD/${name}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2018-08-05 21:57:38 +01:00
|
|
|
dontBuild = true;
|
2017-10-23 17:53:11 +01:00
|
|
|
|
|
|
|
sourceRoot = ".";
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
makeWrapper
|
|
|
|
busybox
|
|
|
|
file
|
|
|
|
gtk2
|
|
|
|
gdk_pixbuf
|
|
|
|
];
|
|
|
|
|
|
|
|
libPath = stdenv.lib.makeLibraryPath [
|
|
|
|
glib
|
|
|
|
gtk2
|
|
|
|
atk
|
|
|
|
gdk_pixbuf
|
|
|
|
cairo
|
|
|
|
pango
|
|
|
|
gnome3.dconf
|
2018-03-13 10:16:03 +00:00
|
|
|
xorg.libX11
|
|
|
|
xorg.libXext
|
|
|
|
xorg.libXrender
|
|
|
|
xorg.libXinerama
|
|
|
|
xorg.libXfixes
|
2017-10-23 17:53:11 +01:00
|
|
|
libpng12
|
2018-06-29 21:24:04 +01:00
|
|
|
libidn_134
|
2017-10-23 17:53:11 +01:00
|
|
|
zlib
|
|
|
|
gtk_engines
|
|
|
|
freetype
|
|
|
|
fontconfig
|
|
|
|
alsaLib
|
|
|
|
stdenv.cc.cc # Fixes: Can not load [..]/opt/citrix-icaclient/lib/ctxh264_fb.so:(null)
|
|
|
|
];
|
|
|
|
|
|
|
|
desktopItem = makeDesktopItem {
|
|
|
|
name = "wfica";
|
|
|
|
desktopName = "Citrix Receiver";
|
|
|
|
genericName = "Citrix Receiver";
|
|
|
|
exec = "wfica";
|
|
|
|
icon = "wfica";
|
|
|
|
comment = "Connect to remote Citrix server";
|
|
|
|
categories = "GTK;GNOME;X-GNOME-NetworkSettings;Network;";
|
|
|
|
mimeType = "application/x-ica";
|
|
|
|
};
|
|
|
|
|
|
|
|
installPhase = ''
|
2018-08-05 21:57:38 +01:00
|
|
|
runHook preInstall
|
|
|
|
|
2017-10-23 17:53:11 +01:00
|
|
|
export ICAInstDir="$out/opt/citrix-icaclient"
|
|
|
|
|
|
|
|
sed -i \
|
|
|
|
-e 's,^main_install_menu$,install_ICA_client,g' \
|
|
|
|
-e 's,^integrate_ICA_client(),alias integrate_ICA_client=true\nintegrate_ICA_client_old(),g' \
|
|
|
|
-e 's,^ANSWER=""$,ANSWER="$INSTALLER_YES",' \
|
|
|
|
-e 's,/bin/true,true,g' \
|
|
|
|
./${prefixWithBitness}/hinst
|
|
|
|
|
|
|
|
# Run the installer...
|
2018-02-24 12:45:47 +00:00
|
|
|
bash ./${prefixWithBitness}/hinst CDROM "`pwd`"
|
2017-10-23 17:53:11 +01:00
|
|
|
|
|
|
|
echo "Deleting broken links..."
|
|
|
|
for link in `find $ICAInstDir -type l `
|
|
|
|
do
|
|
|
|
[ -f "$link" ] || rm -v "$link"
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "Expanding certificates..."
|
|
|
|
# As explained in https://wiki.archlinux.org/index.php/Citrix#Security_Certificates
|
|
|
|
pushd "$ICAInstDir/keystore/cacerts"
|
|
|
|
awk 'BEGIN {c=0;} /BEGIN CERT/{c++} { print > "cert." c ".pem"}' < ${cacert}/etc/ssl/certs/ca-bundle.crt
|
|
|
|
popd
|
|
|
|
|
|
|
|
echo "Patching executables..."
|
|
|
|
find $ICAInstDir -type f -exec file {} \; |
|
|
|
|
grep 'ELF.*executable' |
|
|
|
|
cut -f 1 -d : |
|
2018-06-09 15:11:19 +01:00
|
|
|
grep -vi '\(.dll\|.so\)$' | # added as a workaround to https://github.com/NixOS/nixpkgs/issues/41729
|
2017-10-23 17:53:11 +01:00
|
|
|
while read f
|
|
|
|
do
|
|
|
|
echo "Patching ELF intrepreter and rpath for $f"
|
|
|
|
chmod u+w "$f"
|
|
|
|
patchelf \
|
|
|
|
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
|
|
|
|
--set-rpath "$ICAInstDir:$libPath" "$f"
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "Wrapping wfica..."
|
|
|
|
mkdir "$out/bin"
|
|
|
|
|
|
|
|
makeWrapper "$ICAInstDir/wfica" "$out/bin/wfica" \
|
|
|
|
--add-flags "-icaroot $ICAInstDir" \
|
|
|
|
--set ICAROOT "$ICAInstDir" \
|
2018-07-22 03:03:24 +01:00
|
|
|
--set GTK_PATH "${gtk2.out}/lib/gtk-2.0:${gnome3.gnome-themes-extra}/lib/gtk-2.0" \
|
2017-10-23 17:53:11 +01:00
|
|
|
--set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \
|
|
|
|
--set LD_PRELOAD "${libredirect}/lib/libredirect.so" \
|
|
|
|
--set LD_LIBRARY_PATH "$libPath" \
|
|
|
|
--set NIX_REDIRECTS "/usr/share/zoneinfo=${tzdata}/share/zoneinfo:/etc/zoneinfo=${tzdata}/share/zoneinfo:/etc/timezone=$ICAInstDir/timezone"
|
|
|
|
|
|
|
|
echo "We arbitrarily set the timezone to UTC. No known consequences at this point."
|
|
|
|
echo UTC > "$ICAInstDir/timezone"
|
|
|
|
|
|
|
|
echo "Installing desktop item..."
|
|
|
|
mkdir -p $out/share/applications
|
|
|
|
cp ${desktopItem}/share/applications/* $out/share/applications
|
|
|
|
|
|
|
|
# We introduce a dependency on the source file so that it need not be redownloaded everytime
|
|
|
|
echo $src >> "$out/share/nix_dependencies.pin"
|
2018-08-05 21:57:38 +01:00
|
|
|
|
|
|
|
runHook postInstall
|
2017-10-23 17:53:11 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
license = stdenv.lib.licenses.unfree;
|
|
|
|
inherit homepage;
|
|
|
|
description = "Citrix Receiver";
|
2018-08-05 21:57:38 +01:00
|
|
|
maintainers = with maintainers; [ obadz a1russell ma27 ];
|
2017-10-23 17:53:11 +01:00
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
in citrixReceiverForVersion (lib.getAttr version versionInfo)
|