nixpkgs/pkgs/development/tools/sauce-connect/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

49 lines
1.4 KiB
Nix

{ 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;
};
}