2023-07-22 11:20:34 +00:00
|
|
|
{ lib
|
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
2024-06-06 19:05:43 +00:00
|
|
|
, nix-update-script
|
|
|
|
, nodejs
|
|
|
|
, pnpm
|
2023-07-22 11:20:34 +00:00
|
|
|
}:
|
2024-06-06 19:05:43 +00:00
|
|
|
|
|
|
|
let
|
2023-09-24 18:23:54 +00:00
|
|
|
pname = "pgrok";
|
2023-11-26 23:50:32 +00:00
|
|
|
version = "1.4.1";
|
2023-07-22 11:20:34 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "pgrok";
|
|
|
|
repo = "pgrok";
|
|
|
|
rev = "v${version}";
|
2023-11-26 23:50:32 +00:00
|
|
|
hash = "sha256-P36rpFi5J+dF6FrVaPhqupG00h4kwr0qumt4ehL/7vU=";
|
2023-07-22 11:20:34 +00:00
|
|
|
};
|
2024-06-06 19:05:43 +00:00
|
|
|
in
|
2023-08-22 17:36:10 +00:00
|
|
|
|
2024-06-06 19:05:43 +00:00
|
|
|
buildGoModule {
|
|
|
|
inherit pname version src;
|
2023-07-22 11:20:34 +00:00
|
|
|
|
2023-09-24 18:23:54 +00:00
|
|
|
outputs = [ "out" "server" ];
|
|
|
|
|
2024-06-06 19:05:43 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
nodejs
|
|
|
|
pnpm.configHook
|
|
|
|
];
|
|
|
|
|
|
|
|
pnpmDeps = pnpm.fetchDeps {
|
|
|
|
inherit pname version src;
|
2024-10-18 22:31:36 +00:00
|
|
|
hash = "sha256-xObDEkNGMXcUqX9thAJoE45yzd7f15k2odDWv9X3RRE=";
|
2024-06-06 19:05:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
vendorHash = "sha256-X5FjzliIJdfJnNaUXBjv1uq5tyjMVjBbnLCBH/P0LFM=";
|
2023-07-22 11:20:34 +00:00
|
|
|
|
|
|
|
ldflags = [
|
|
|
|
"-s"
|
|
|
|
"-w"
|
|
|
|
"-X main.version=${version}"
|
|
|
|
"-X main.commit=unknown"
|
|
|
|
"-X main.date=unknown"
|
|
|
|
];
|
|
|
|
|
2023-08-22 17:36:10 +00:00
|
|
|
subPackages = [
|
|
|
|
"pgrok/pgrok"
|
|
|
|
"pgrokd/pgrokd"
|
|
|
|
];
|
|
|
|
|
2024-06-06 19:05:43 +00:00
|
|
|
preBuild = ''
|
|
|
|
pushd pgrokd/web
|
|
|
|
|
|
|
|
pnpm run build
|
|
|
|
|
|
|
|
popd
|
|
|
|
|
2023-08-22 17:36:10 +00:00
|
|
|
# rename packages due to naming conflict
|
|
|
|
mv pgrok/cli/ pgrok/pgrok/
|
|
|
|
mv pgrokd/cli/ pgrokd/pgrokd/
|
|
|
|
'';
|
|
|
|
|
2023-07-22 11:20:34 +00:00
|
|
|
postInstall = ''
|
|
|
|
moveToOutput bin/pgrokd $server
|
|
|
|
'';
|
|
|
|
|
2024-06-06 19:05:43 +00:00
|
|
|
passthru.updateScript = nix-update-script { };
|
2023-07-22 11:20:34 +00:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Selfhosted TCP/HTTP tunnel, ngrok alternative, written in Go";
|
|
|
|
homepage = "https://github.com/pgrok/pgrok";
|
|
|
|
license = lib.licenses.mit;
|
|
|
|
maintainers = with lib.maintainers; [ marie ];
|
2024-02-11 02:19:15 +00:00
|
|
|
mainProgram = "pgrok";
|
2023-07-22 11:20:34 +00:00
|
|
|
};
|
|
|
|
}
|