Luke Granger-Brown
57725ef3ec
git-subtree-dir: third_party/nixpkgs git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
81 lines
1.8 KiB
Nix
81 lines
1.8 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
fetchurl,
|
|
testers,
|
|
}:
|
|
|
|
let
|
|
versions = lib.importJSON ./versions.json;
|
|
arch =
|
|
if stdenv.hostPlatform.isi686 then
|
|
"386"
|
|
else if stdenv.hostPlatform.isx86_64 then
|
|
"amd64"
|
|
else if stdenv.hostPlatform.isAarch32 then
|
|
"arm"
|
|
else if stdenv.hostPlatform.isAarch64 then
|
|
"arm64"
|
|
else
|
|
throw "Unsupported architecture";
|
|
os =
|
|
if stdenv.hostPlatform.isLinux then
|
|
"linux"
|
|
else if stdenv.hostPlatform.isDarwin then
|
|
"darwin"
|
|
else
|
|
throw "Unsupported os";
|
|
versionInfo = versions."${os}-${arch}";
|
|
inherit (versionInfo) version sha256 url;
|
|
|
|
in
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "ngrok";
|
|
inherit version;
|
|
|
|
# run ./update
|
|
src = fetchurl { inherit sha256 url; };
|
|
|
|
sourceRoot = ".";
|
|
|
|
unpackPhase = ''
|
|
runHook preUnpack
|
|
cp $src ngrok
|
|
runHook postUnpack
|
|
'';
|
|
|
|
buildPhase = ''
|
|
runHook preBuild
|
|
chmod a+x ngrok
|
|
runHook postBuild
|
|
'';
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
install -D ngrok $out/bin/ngrok
|
|
runHook postInstall
|
|
'';
|
|
|
|
passthru = {
|
|
updateScript = ./update.sh;
|
|
tests.version = testers.testVersion { package = finalAttrs.finalPackage; };
|
|
};
|
|
|
|
# Stripping causes SEGFAULT on darwin
|
|
dontStrip = stdenv.hostPlatform.isDarwin;
|
|
|
|
meta = {
|
|
description = "Allows you to expose a web server running on your local machine to the internet";
|
|
homepage = "https://ngrok.com/";
|
|
downloadPage = "https://ngrok.com/download";
|
|
changelog = "https://ngrok.com/docs/agent/changelog/";
|
|
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
|
|
license = lib.licenses.unfree;
|
|
platforms = lib.platforms.unix;
|
|
maintainers = with lib.maintainers; [
|
|
bobvanderlinden
|
|
brodes
|
|
];
|
|
mainProgram = "ngrok";
|
|
};
|
|
})
|