nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 fetchurl,
5 zlib,
6 unzip,
7 installShellFiles,
8}:
9
10stdenv.mkDerivation rec {
11 pname = "sauce-connect";
12 version = "5.2.2";
13
14 passthru = {
15 sources = {
16 x86_64-linux = fetchurl {
17 url = "https://saucelabs.com/downloads/sauce-connect/${version}/sauce-connect-${version}_linux.x86_64.tar.gz";
18 hash = "sha256-JyQkXp7/jrgWEKNPHUw/exXc5nqjejHWsy3IiEJ5gqU=";
19 };
20 aarch64-linux = fetchurl {
21 url = "https://saucelabs.com/downloads/sauce-connect/${version}/sauce-connect-${version}_linux.aarch64.tar.gz";
22 hash = "sha256-8EZjqid4/r2p8jZxQiI1x1IyDFXHwWDbmCOVXdnmmgs=";
23 };
24 x86_64-darwin = fetchurl {
25 url = "https://saucelabs.com/downloads/sauce-connect/${version}/sauce-connect-${version}_darwin.all.zip";
26 hash = "sha256-E4S7hbLSnRd5M/yOiUyPasYNg7ZmQ10S6fyn9Qs1BFk=";
27 };
28 aarch64-darwin = passthru.sources.x86_64-darwin;
29 };
30 updateScript = ./update.sh;
31 };
32
33 src =
34 passthru.sources.${stdenv.hostPlatform.system}
35 or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
36
37 unpackPhase = ''
38 runHook preUnpack
39
40 mkdir source
41 ${lib.optionalString stdenv.hostPlatform.isLinux "tar -zxvf $src -C source"}
42 ${lib.optionalString stdenv.hostPlatform.isDarwin "unzip $src -d source"}
43
44 runHook postUnpack
45 '';
46
47 sourceRoot = "source";
48
49 nativeBuildInputs = [
50 unzip
51 installShellFiles
52 ];
53
54 installPhase = ''
55 runHook preInstall
56
57 install -Dm755 sc $out/bin/sc
58 installShellCompletion --bash --name sc.bash completions/sc.bash
59 installShellCompletion --fish --name sc.fish completions/sc.fish
60 installShellCompletion --zsh --name _sc completions/sc.zsh
61 install -Dm644 LICENSE $out/share/licenses/sauce-connect/LICENSE
62 install -Dm644 LICENSE.3RD_PARTY $out/share/licenses/sauce-connect/LICENSE.3RD_PARTY
63 install -Dm644 sauce-connect.yaml $out/etc/sauce-connect.yaml
64
65 runHook postInstall
66 '';
67
68 dontStrip = true;
69
70 meta = {
71 description = "Secure tunneling app for executing tests securely when testing behind firewalls";
72 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
73 license = lib.licenses.unfree;
74 homepage = "https://docs.saucelabs.com/reference/sauce-connect/";
75 maintainers = with lib.maintainers; [ offline ];
76 platforms = builtins.attrNames passthru.sources;
77 };
78}