about summary refs log tree commit diff
path: root/pkgs/development/tools/sauce-connect/default.nix
blob: 6d3c5434e20ac606d57dc1ab658f3984e40dfc1a (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
38
39
40
41
42
43
44
45
46
47
48
{ stdenv, lib, fetchurl, zlib, unzip }:

stdenv.mkDerivation rec {
  pname = "sauce-connect";
  version = "4.9.1";

  passthru = {
    sources = {
      x86_64-linux = fetchurl {
        url = "https://saucelabs.com/downloads/sc-${version}-linux.tar.gz";
        hash = "sha256-S3vzng6b0giB6Zceaxi62pQOEHysIR/vVQmswkEZ0/M=";
      };
      x86_64-darwin = fetchurl {
        url = "https://saucelabs.com/downloads/sc-${version}-osx.zip";
        hash = "sha256-6tJayqo+p7PMz8M651ikHz6tEjGjRIffOqQBchkpW5Q=";
      };
      aarch64-darwin = passthru.sources.x86_64-darwin;
    };
  };

  src = passthru.sources.${stdenv.hostPlatform.system}
    or (throw "Unsupported system: ${stdenv.hostPlatform.system}");

  nativeBuildInputs = [ unzip ];

  patchPhase = lib.optionalString stdenv.hostPlatform.isLinux ''
    patchelf \
      --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
      --set-rpath "$out/lib:${lib.makeLibraryPath [zlib]}" \
      bin/sc
  '';

  installPhase = ''
    mkdir -p $out
    cp -r * $out
  '';

  dontStrip = true;

  meta = with lib; {
    description = "Secure tunneling app for executing tests securely when testing behind firewalls";
    sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
    license = licenses.unfree;
    homepage = "https://docs.saucelabs.com/reference/sauce-connect/";
    maintainers = with maintainers; [ offline ];
    platforms = builtins.attrNames passthru.sources;
  };
}