nixpkgs/pkgs/applications/networking/appgate-sdp/default.nix

192 lines
4.4 KiB
Nix
Raw Normal View History

{ alsa-lib
2021-01-05 08:52:55 +00:00
, at-spi2-atk
, at-spi2-core
, atk
, bash
, cairo
, coreutils
, cups
, curl
, dbus
, dnsmasq
, dpkg
, e2fsprogs
, expat
, fetchurl
, gdk-pixbuf
, glib
, gtk3
, icu
2021-03-14 16:05:16 +00:00
, iproute2
2021-01-05 08:52:55 +00:00
, krb5
, lib
2021-01-11 10:51:00 +00:00
, mesa
, libdrm
2021-01-05 08:52:55 +00:00
, libX11
, libXScrnSaver
, libXcomposite
, libXcursor
, libXdamage
, libXext
, libXfixes
, libXi
, libXrandr
, libXrender
, libXtst
2021-05-06 12:08:19 +00:00
, libxkbcommon
2021-01-05 08:52:55 +00:00
, libsecret
, libuuid
, libxcb
, lttng-ust
, makeWrapper
, networkmanager
, nspr
, nss
, openssl
, pango
, procps
, python37
, python37Packages
, stdenv
, systemd
2021-04-06 16:52:18 +00:00
, xdg-utils
2021-01-05 08:52:55 +00:00
, zlib
}:
2021-01-15 13:21:58 +00:00
with lib;
2021-01-05 08:52:55 +00:00
let
deps = [
alsa-lib
2021-01-05 08:52:55 +00:00
at-spi2-atk
at-spi2-core
atk
cairo
cups
curl
dbus
expat
gdk-pixbuf
glib
gtk3
icu
krb5
2021-01-11 10:51:00 +00:00
mesa
libdrm
2021-01-05 08:52:55 +00:00
libX11
libXScrnSaver
libXcomposite
libXcursor
libXdamage
libXext
libXfixes
libXi
libXrandr
libXrender
libXtst
2021-05-06 12:08:19 +00:00
libxkbcommon
2021-01-05 08:52:55 +00:00
libsecret
libuuid
libxcb
lttng-ust
nspr
nss
openssl
pango
stdenv.cc.cc
systemd
zlib
];
2021-04-06 16:52:18 +00:00
rpath = lib.makeLibraryPath deps;
2021-01-05 08:52:55 +00:00
in
stdenv.mkDerivation rec {
pname = "appgate-sdp";
2021-06-18 10:55:07 +00:00
version = "5.4.2";
2021-01-05 08:52:55 +00:00
src = fetchurl {
2021-01-11 10:51:00 +00:00
url = "https://bin.appgate-sdp.com/${lib.versions.majorMinor version}/client/appgate-sdp_${version}_amd64.deb";
2021-06-18 10:55:07 +00:00
sha256 = "sha256-wAhcTRO/Cd4MG1lfPNDq92yGcu3NOfymucddy92VaXo=";
2021-01-05 08:52:55 +00:00
};
dontConfigure = true;
dontBuild = true;
enableParallelBuilding = true;
buildInputs = [
python37
python37Packages.dbus-python
];
nativeBuildInputs = [
makeWrapper
dpkg
];
unpackPhase = ''
dpkg-deb -x $src $out
'';
installPhase = ''
mkdir -p $out/bin
ln -s "$out/opt/appgate/appgate" "$out/bin/appgate"
cp -r $out/usr/share $out/share
for file in $out/opt/appgate/linux/appgate-resolver.pre \
2021-01-11 10:51:00 +00:00
$out/opt/appgate/linux/appgate-dumb-resolver.pre
2021-01-05 08:52:55 +00:00
do
substituteInPlace $file \
--replace "/bin/sh" "${bash}/bin/sh" \
--replace "cat" "${coreutils}/bin/cat" \
--replace "chattr" "${e2fsprogs}/bin/chattr" \
2021-02-21 15:19:02 +00:00
--replace "mv " "${coreutils}/bin/mv " \
2021-01-05 08:52:55 +00:00
--replace "pkill" "${procps}/bin/pkill"
done
2021-01-11 10:51:00 +00:00
for file in $out/lib/systemd/system/appgatedriver.service \
$out/lib/systemd/system/appgate-dumb-resolver.service \
$out/lib/systemd/system/appgate-resolver.service
do
substituteInPlace $file \
--replace "/bin/sh" "${bash}/bin/sh" \
--replace "/opt/" "$out/opt/" \
--replace "chattr" "${e2fsprogs}/bin/chattr" \
2021-02-21 15:19:02 +00:00
--replace "mv " "${coreutils}/bin/mv "
2021-01-11 10:51:00 +00:00
done
substituteInPlace $out/lib/systemd/system/appgatedriver.service \
--replace "InaccessiblePaths=/mnt /srv /boot /media" "InaccessiblePaths=-/mnt -/srv -/boot -/media"
substituteInPlace $out/lib/systemd/system/appgate-resolver.service \
--replace "/usr/sbin/dnsmasq" "${dnsmasq}/bin/dnsmasq"
2021-01-05 08:52:55 +00:00
substituteInPlace $out/opt/appgate/linux/nm.py --replace "/usr/sbin/dnsmasq" "${dnsmasq}/bin/dnsmasq"
2021-01-11 10:51:00 +00:00
substituteInPlace $out/opt/appgate/linux/set_dns --replace "/etc/appgate.conf" "$out/etc/appgate.conf"
2021-01-05 08:52:55 +00:00
'';
postFixup = ''
find $out -type f -name "*.so" -exec patchelf --set-rpath '$ORIGIN:${rpath}' {} \;
for binary in $out/opt/appgate/appgate-driver \
$out/opt/appgate/appgate \
$out/opt/appgate/service/createdump \
$out/opt/appgate/service/appgateservice.bin
do
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" --set-rpath "$ORIGIN:$out/opt/appgate/service/:$out/opt/appgate/:${rpath}" $binary
done
2021-05-06 12:08:19 +00:00
# fail if there are missing dependencies
ldd $out/opt/appgate/appgate | grep -i 'not found' && exit 1
ldd $out/opt/appgate/service/appgateservice.bin | grep -i 'not found' && exit 1
ldd $out/opt/appgate/appgate-driver | grep -i 'not found' && exit 1
2021-03-14 16:05:16 +00:00
wrapProgram $out/opt/appgate/appgate-driver --prefix PATH : ${lib.makeBinPath [ iproute2 networkmanager dnsmasq ]}
2021-01-05 08:52:55 +00:00
wrapProgram $out/opt/appgate/linux/set_dns --set PYTHONPATH $PYTHONPATH
2021-05-06 12:08:19 +00:00
wrapProgram $out/bin/appgate --prefix PATH : ${lib.makeBinPath [ xdg-utils ]}
2021-01-05 08:52:55 +00:00
'';
meta = with lib; {
2021-01-05 08:52:55 +00:00
description = "Appgate SDP (Software Defined Perimeter) desktop client";
2021-02-21 15:19:02 +00:00
homepage = "https://www.appgate.com/support/software-defined-perimeter-support";
2021-01-05 08:52:55 +00:00
license = licenses.unfree;
platforms = platforms.linux;
maintainers = with maintainers; [ ymatsiuk ];
};
}