summary refs log tree commit diff
path: root/pkgs/tools/networking/snx/default.nix
blob: b4cdd0d0b99a69c5cd2d52dc0b6672851d2d6211 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{ stdenv, fetchurl, makeWrapper, libX11, pam, gcc33 }:

let
  # The proper value for this offset can be found at the top of the snx_install script.
  archiveOffset = "78";
  libraryPath = stdenv.lib.makeSearchPath "lib" [libX11 pam gcc33.gcc];
in
stdenv.mkDerivation rec {
  name = "snx-800007027";

  src = fetchurl {
    url = "https://remote.us.publicisgroupe.net/CSHELL/snx_install.sh";
    sha256 = "1yq0r8gb6jw5pyfrw3wxvplrxxfhbhgm9ph4gyd754fyn52iwgxv";
  };

  buildInputs = [makeWrapper];

  unpackPhase = ''
    tail -n +${archiveOffset} ${src} | bunzip2 -c - | tar xfvp -
  '';

  buildPhase = ''
    patchelf --set-interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" snx
  '';

  installPhase = ''
    mkdir -p "$out/sbin" "$out/libexec"
    mv snx "$out/libexec/"
    makeWrapper "$out/libexec/snx" "$out/sbin/snx" --prefix LD_LIBRARY_PATH ":" "${libraryPath}"
  '';

  meta = {
    homepage = "https://www.checkpoint.com/";
    description = "Check Point SSL Network Extender";
    license = "unknown";
  };
}