Skip to content

Commit 1ee8160

Browse files
authored
rapidapi: init at 4.2.8-4002008002 (NixOS#348239)
2 parents 975fd3f + b8a273f commit 1ee8160

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{
2+
lib,
3+
stdenvNoCC,
4+
fetchurl,
5+
unzip,
6+
writeShellApplication,
7+
curl,
8+
cacert,
9+
gnugrep,
10+
common-updater-scripts,
11+
versionCheckHook,
12+
writeShellScript,
13+
xcbuild,
14+
coreutils,
15+
}:
16+
17+
stdenvNoCC.mkDerivation (finalAttrs: {
18+
pname = "rapidapi";
19+
version = "4.2.8-4002008002";
20+
21+
src = fetchurl {
22+
url = "https://cdn-builds.paw.cloud/paw/RapidAPI-${finalAttrs.version}.zip";
23+
hash = "sha256-ApBOYMOjpQJvUe+JsEAnyK7xpIZNt6qkX/2KUIT6S8g=";
24+
};
25+
26+
dontPatch = true;
27+
dontConfigure = true;
28+
dontBuild = true;
29+
dontFixup = true;
30+
dontUnpack = true;
31+
32+
nativeBuildInputs = [ unzip ];
33+
34+
sourceRoot = "RapidAPI.app";
35+
36+
installPhase = ''
37+
runHook preInstall
38+
39+
mkdir -p $out/Applications
40+
unzip -d $out/Applications $src
41+
42+
runHook postInstall
43+
'';
44+
45+
passthru.updateScript = lib.getExe (writeShellApplication {
46+
name = "rapidapi-update-script";
47+
runtimeInputs = [
48+
curl
49+
cacert
50+
gnugrep
51+
common-updater-scripts
52+
];
53+
text = ''
54+
url="https://paw.cloud/download"
55+
version=$(curl -Ls -o /dev/null -w "%{url_effective}" "$url" | grep -oP '\d+\.\d+\.\d+-\d+')
56+
update-source-version rapidapi "$version"
57+
'';
58+
});
59+
60+
nativeInstallCheckInputs = [ versionCheckHook ];
61+
versionCheckProgram = writeShellScript "version-check" ''
62+
marketing_version=$(${xcbuild}/bin/PlistBuddy -c "Print :CFBundleShortVersionString" "$1" | ${coreutils}/bin/tr -d '"')
63+
build_version=$(${xcbuild}/bin/PlistBuddy -c "Print :CFBundleVersion" "$1")
64+
echo $marketing_version-$build_version
65+
'';
66+
versionCheckProgramArg = [ "${placeholder "out"}/Applications/RapidAPI.app/Contents/Info.plist" ];
67+
doInstallCheck = true;
68+
69+
meta = {
70+
description = "Full-featured HTTP client that lets you test and describe the APIs you build or consume";
71+
homepage = "https://paw.cloud";
72+
changelog = "https://paw.cloud/updates/${lib.head (lib.splitString "-" finalAttrs.version)}";
73+
license = lib.licenses.unfree;
74+
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
75+
maintainers = with lib.maintainers; [ DimitarNestorov ];
76+
platforms = [
77+
"aarch64-darwin"
78+
"x86_64-darwin"
79+
];
80+
};
81+
})

0 commit comments

Comments
 (0)