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
80 lines
2.1 KiB
Nix
80 lines
2.1 KiB
Nix
{
|
|
lib,
|
|
stdenvNoCC,
|
|
fetchurl,
|
|
unzip,
|
|
writeShellApplication,
|
|
curl,
|
|
cacert,
|
|
gnugrep,
|
|
common-updater-scripts,
|
|
versionCheckHook,
|
|
writeShellScript,
|
|
re-plistbuddy,
|
|
}:
|
|
|
|
stdenvNoCC.mkDerivation (finalAttrs: {
|
|
pname = "rapidapi";
|
|
version = "4.5.5-4005005001";
|
|
|
|
src = fetchurl {
|
|
url = "https://cdn-builds.paw.cloud/paw/RapidAPI-${finalAttrs.version}.zip";
|
|
hash = "sha256-1UR7Lj/4fdhwYIvlWjso8tGDO+0sH8XkiysXN2i6/78=";
|
|
};
|
|
|
|
dontPatch = true;
|
|
dontConfigure = true;
|
|
dontBuild = true;
|
|
dontFixup = true;
|
|
dontUnpack = true;
|
|
|
|
nativeBuildInputs = [ unzip ];
|
|
|
|
sourceRoot = "RapidAPI.app";
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
mkdir -p $out/Applications
|
|
unzip -d $out/Applications $src
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
passthru.updateScript = lib.getExe (writeShellApplication {
|
|
name = "rapidapi-update-script";
|
|
runtimeInputs = [
|
|
curl
|
|
cacert
|
|
gnugrep
|
|
common-updater-scripts
|
|
];
|
|
text = ''
|
|
url="https://paw.cloud/download"
|
|
version=$(curl -Ls -o /dev/null -w "%{url_effective}" "$url" | grep -oP '\d+\.\d+\.\d+-\d+')
|
|
update-source-version rapidapi "$version"
|
|
'';
|
|
});
|
|
|
|
nativeInstallCheckInputs = [ versionCheckHook ];
|
|
versionCheckProgram = writeShellScript "version-check" ''
|
|
marketing_version=$(${lib.getExe' re-plistbuddy "PlistBuddy"} -c "Print :CFBundleShortVersionString" "$1")
|
|
build_version=$(${lib.getExe' re-plistbuddy "PlistBuddy"} -c "Print :CFBundleVersion" "$1")
|
|
echo $marketing_version-$build_version
|
|
'';
|
|
versionCheckProgramArg = [ "${placeholder "out"}/Applications/RapidAPI.app/Contents/Info.plist" ];
|
|
doInstallCheck = true;
|
|
|
|
meta = {
|
|
description = "Full-featured HTTP client that lets you test and describe the APIs you build or consume";
|
|
homepage = "https://paw.cloud";
|
|
changelog = "https://paw.cloud/updates/${lib.head (lib.splitString "-" finalAttrs.version)}";
|
|
license = lib.licenses.unfree;
|
|
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
|
|
maintainers = with lib.maintainers; [ DimitarNestorov ];
|
|
platforms = [
|
|
"aarch64-darwin"
|
|
];
|
|
};
|
|
})
|