btrbk: add mainProgram (#356350)
[NixPkgs.git] / pkgs / by-name / ap / appgate-sdp / package.nix
blobbd0b9283c54ba9a19644a1d627badae7d9b749cc
1 { alsa-lib
2 , at-spi2-atk
3 , at-spi2-core
4 , atk
5 , autoPatchelfHook
6 , cairo
7 , cups
8 , curl
9 , dbus
10 , dnsmasq
11 , dpkg
12 , expat
13 , fetchurl
14 , gdk-pixbuf
15 , glib
16 , gtk3
17 , icu
18 , iproute2
19 , krb5
20 , lib
21 , libdrm
22 , libsecret
23 , libuuid
24 , libxcb
25 , libxkbcommon
26 , lttng-ust
27 , makeWrapper
28 , mesa
29 , networkmanager
30 , nspr
31 , nss
32 , openssl
33 , pango
34 , python3
35 , stdenv
36 , systemd
37 , xdg-utils
38 , xorg
39 , zlib
42 let
43   deps = [
44     alsa-lib
45     at-spi2-atk
46     at-spi2-core
47     atk
48     cairo
49     cups
50     curl
51     dbus
52     expat
53     gdk-pixbuf
54     glib
55     gtk3
56     icu
57     krb5
58     libdrm
59     libsecret
60     libuuid
61     libxcb
62     libxkbcommon
63     lttng-ust
64     mesa
65     nspr
66     nss
67     openssl
68     pango
69     stdenv.cc.cc
70     systemd
71     xorg.libX11
72     xorg.libXScrnSaver
73     xorg.libXcomposite
74     xorg.libXcursor
75     xorg.libXdamage
76     xorg.libXext
77     xorg.libXfixes
78     xorg.libXi
79     xorg.libXrandr
80     xorg.libXrender
81     xorg.libXtst
82     xorg.libxkbfile
83     xorg.libxshmfence
84     zlib
85   ];
87 stdenv.mkDerivation rec {
88   pname = "appgate-sdp";
89   version = "6.4.0";
91   src = fetchurl {
92     url = "https://bin.appgate-sdp.com/${lib.versions.majorMinor version}/client/appgate-sdp_${version}_amd64.deb";
93     sha256 = "sha256-0h6Mz3B7fADGL5tGbrKNYpVIAvRu7Xx0n9OvjOeVCds=";
94   };
96   # just patch interpreter
97   autoPatchelfIgnoreMissingDeps = true;
98   dontConfigure = true;
99   dontBuild = true;
101   buildInputs = [
102     python3
103     python3.pkgs.dbus-python
104   ];
106   nativeBuildInputs = [
107     autoPatchelfHook
108     makeWrapper
109     dpkg
110   ];
112   unpackPhase = ''
113     dpkg-deb -x $src $out
114   '';
116   installPhase = ''
117     cp -r $out/usr/share $out/share
119     substituteInPlace $out/lib/systemd/system/appgate-dumb-resolver.service \
120         --replace "/opt/" "$out/opt/"
122     substituteInPlace $out/lib/systemd/system/appgatedriver.service \
123         --replace "/opt/" "$out/opt/" \
124         --replace "InaccessiblePaths=/mnt /srv /boot /media" "InaccessiblePaths=-/mnt -/srv -/boot -/media"
126     substituteInPlace $out/lib/systemd/system/appgate-resolver.service \
127         --replace "/usr/sbin/dnsmasq" "${dnsmasq}/bin/dnsmasq" \
128         --replace "/opt/" "$out/opt/"
130     substituteInPlace $out/opt/appgate/linux/nm.py \
131         --replace "/usr/sbin/dnsmasq" "${dnsmasq}/bin/dnsmasq"
133     substituteInPlace $out/opt/appgate/linux/set_dns \
134         --replace "/etc/appgate.conf" "$out/etc/appgate.conf"
136     wrapProgram $out/opt/appgate/service/createdump \
137         --set LD_LIBRARY_PATH "${lib.makeLibraryPath [ stdenv.cc.cc ]}"
139     wrapProgram $out/opt/appgate/appgate-driver \
140         --prefix PATH : ${lib.makeBinPath [ iproute2 networkmanager dnsmasq ]} \
141         --set LD_LIBRARY_PATH $out/opt/appgate/service
143     # make xdg-open overrideable at runtime
144     makeWrapper $out/opt/appgate/Appgate $out/bin/appgate \
145         --suffix PATH : ${lib.makeBinPath [ xdg-utils ]} \
146         --set LD_LIBRARY_PATH $out/opt/appgate:${lib.makeLibraryPath deps}
148     wrapProgram $out/opt/appgate/linux/set_dns --set PYTHONPATH $PYTHONPATH
149   '';
151   meta = with lib; {
152     description = "Appgate SDP (Software Defined Perimeter) desktop client";
153     homepage = "https://www.appgate.com/support/software-defined-perimeter-support";
154     sourceProvenance = with sourceTypes; [ binaryNativeCode ];
155     license = licenses.unfree;
156     platforms = platforms.linux;
157     maintainers = with maintainers; [ ymatsiuk ];
158     mainProgram = "appgate";
159   };