fdb820602b
To reproduce:
$ nix run nixpkgs/3b32825de172d0bc85664f495edb096b10862524#ast-grep \
-- scan --update-all --inline-rules '
id: nix-x86_64-darwin
language: nix
rule:
any:
- pattern: "\"x86_64-darwin\""
kind: list_expression > string_expression
- pattern:
context: "{ \"x86_64-darwin\" = $EXPR; }"
selector: binding
- pattern:
context: "{ x86_64-darwin = $EXPR; }"
selector: binding
fix:
template: ""
' pkgs
$ nix run nixpkgs/3b32825de172d0bc85664f495edb096b10862524#ast-grep \
-- scan --update-all --inline-rules '
id: json-first-x86_64-darwin
language: json
rule:
kind: object > pair:nth-child(1)
has:
pattern: "\"x86_64-darwin\""
field: key
fix:
template: ""
expandEnd: { regex: "," }
' pkgs
$ nix run nixpkgs/3b32825de172d0bc85664f495edb096b10862524#ast-grep \
-- scan --update-all --inline-rules '
id: json-x86_64-darwin
language: json
rule:
kind: object > pair
has:
pattern: "\"x86_64-darwin\""
field: key
fix:
template: ""
expandStart: { regex: "," }
' pkgs
$ git restore pkgs/by-name/om/omnix/package.nix
$ git diff --name-only -z \
| nix shell nixpkgs/3b32825de172d0bc85664f495edb096b10862524#gnused \
-c xargs -0 sed -i '/^$/N; /^\n\? \+$/d'
$ treefmt
112 lines
2.6 KiB
Nix
112 lines
2.6 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
fetchurl,
|
|
glib,
|
|
libxcb,
|
|
nspr,
|
|
nss,
|
|
autoPatchelfHook,
|
|
unzip,
|
|
}:
|
|
|
|
version: hashes:
|
|
let
|
|
pname = "electron-chromedriver";
|
|
|
|
meta = {
|
|
homepage = "https://www.electronjs.org/";
|
|
description = "WebDriver server for running Selenium tests on Chrome";
|
|
longDescription = ''
|
|
WebDriver is an open source tool for automated testing of webapps across
|
|
many browsers. It provides capabilities for navigating to web pages, user
|
|
input, JavaScript execution, and more. ChromeDriver is a standalone
|
|
server that implements the W3C WebDriver standard. This is
|
|
an unofficial build of ChromeDriver compiled by the Electronjs
|
|
project.
|
|
'';
|
|
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
|
|
license = lib.licenses.mit;
|
|
maintainers = with lib.maintainers; [
|
|
liammurphy14
|
|
];
|
|
teams = [ lib.teams.electron ];
|
|
platforms = [
|
|
"x86_64-linux"
|
|
"armv7l-linux"
|
|
"aarch64-linux"
|
|
"aarch64-darwin"
|
|
];
|
|
mainProgram = "chromedriver";
|
|
};
|
|
|
|
fetcher =
|
|
vers: tag: hash:
|
|
fetchurl {
|
|
url = "https://github.com/electron/electron/releases/download/v${vers}/chromedriver-v${vers}-${tag}.zip";
|
|
sha256 = hash;
|
|
};
|
|
|
|
tags = {
|
|
x86_64-linux = "linux-x64";
|
|
aarch64-linux = "linux-arm64";
|
|
armv7l-linux = "linux-armv7l";
|
|
aarch64-darwin = "darwin-arm64";
|
|
};
|
|
|
|
get = as: platform: as.${platform.system} or (throw "Unsupported system: ${platform.system}");
|
|
|
|
common = platform: {
|
|
inherit pname version meta;
|
|
src = fetcher version (get tags platform) (get hashes platform);
|
|
|
|
buildInputs = [
|
|
(lib.getLib stdenv.cc.cc)
|
|
glib
|
|
libxcb
|
|
nspr
|
|
nss
|
|
];
|
|
};
|
|
|
|
linux = {
|
|
nativeBuildInputs = [
|
|
autoPatchelfHook
|
|
unzip
|
|
];
|
|
|
|
dontUnpack = true;
|
|
dontBuild = true;
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
unzip $src
|
|
install -m777 -D chromedriver $out/bin/chromedriver
|
|
runHook postInstall
|
|
'';
|
|
|
|
__structuredAttrs = true;
|
|
strictDeps = true;
|
|
};
|
|
|
|
darwin = {
|
|
nativeBuildInputs = [ unzip ];
|
|
|
|
dontUnpack = true;
|
|
dontBuild = true;
|
|
|
|
# darwin distributions come with libffmpeg dependency + icudtl.dat file
|
|
installPhase = ''
|
|
runHook preInstall
|
|
unzip $src
|
|
install -m777 -D chromedriver $out/bin/chromedriver
|
|
cp libffmpeg.dylib $out/bin/libffmpeg.dylib
|
|
cp icudtl.dat $out/bin/icudtl.dat
|
|
runHook postInstall
|
|
'';
|
|
};
|
|
in
|
|
stdenv.mkDerivation (
|
|
(common stdenv.hostPlatform) // (if stdenv.hostPlatform.isDarwin then darwin else linux)
|
|
)
|