nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 testers,
6}:
7
8let
9 versions = lib.importJSON ./versions.json;
10 arch =
11 if stdenv.hostPlatform.isi686 then
12 "386"
13 else if stdenv.hostPlatform.isx86_64 then
14 "amd64"
15 else if stdenv.hostPlatform.isAarch32 then
16 "arm"
17 else if stdenv.hostPlatform.isAarch64 then
18 "arm64"
19 else
20 throw "Unsupported architecture";
21 os =
22 if stdenv.hostPlatform.isLinux then
23 "linux"
24 else if stdenv.hostPlatform.isDarwin then
25 "darwin"
26 else
27 throw "Unsupported os";
28 versionInfo = versions."${os}-${arch}";
29 inherit (versionInfo) version sha256 url;
30
31in
32stdenv.mkDerivation (finalAttrs: {
33 pname = "ngrok";
34 inherit version;
35
36 # run ./update
37 src = fetchurl { inherit sha256 url; };
38
39 sourceRoot = ".";
40
41 unpackPhase = ''
42 runHook preUnpack
43 cp $src ngrok
44 runHook postUnpack
45 '';
46
47 buildPhase = ''
48 runHook preBuild
49 chmod a+x ngrok
50 runHook postBuild
51 '';
52
53 installPhase = ''
54 runHook preInstall
55 install -D ngrok $out/bin/ngrok
56 runHook postInstall
57 '';
58
59 passthru = {
60 updateScript = ./update.sh;
61 tests.version = testers.testVersion { package = finalAttrs.finalPackage; };
62 };
63
64 # Stripping causes SEGFAULT on darwin
65 dontStrip = stdenv.hostPlatform.isDarwin;
66
67 meta = {
68 description = "Allows you to expose a web server running on your local machine to the internet";
69 homepage = "https://ngrok.com/";
70 downloadPage = "https://ngrok.com/download";
71 changelog = "https://ngrok.com/docs/agent/changelog/";
72 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
73 license = lib.licenses.unfree;
74 platforms = lib.platforms.unix;
75 maintainers = with lib.maintainers; [
76 bobvanderlinden
77 brodes
78 ];
79 mainProgram = "ngrok";
80 };
81})