From 445e5f83d472e4b5cc0ee75420851d8cf7c592d0 Mon Sep 17 00:00:00 2001 From: Jon Seager Date: Wed, 27 Nov 2024 17:41:14 +0000 Subject: [PATCH] parca: init at 0.22.0 --- pkgs/by-name/pa/parca/package.nix | 80 +++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 pkgs/by-name/pa/parca/package.nix diff --git a/pkgs/by-name/pa/parca/package.nix b/pkgs/by-name/pa/parca/package.nix new file mode 100644 index 0000000000000..a906f7edf794f --- /dev/null +++ b/pkgs/by-name/pa/parca/package.nix @@ -0,0 +1,80 @@ +{ + buildGoModule, + faketty, + fetchFromGitHub, + lib, + nodejs, + pnpm, + stdenv, +}: +let + version = "0.22.0"; + + parca-src = fetchFromGitHub { + owner = "parca-dev"; + repo = "parca"; + rev = "refs/tags/v${version}"; + hash = "sha256-iuTlKUmugRum0qZRhuw0FR13iE2qrQegTgwpAvgJSXk="; + }; + + ui = stdenv.mkDerivation (finalAttrs: { + inherit version; + pname = "parca-ui"; + src = "${parca-src}/ui"; + + pnpmDeps = pnpm.fetchDeps { + inherit (finalAttrs) pname src version; + hash = "sha256-MVNO24Oksy/qRUmEUoWoviQEo6Eimb18ZnDj5Z1vJkY="; + }; + + nativeBuildInputs = [ + faketty + nodejs + pnpm.configHook + ]; + + # faketty is required to work around a bug in nx. + # See: https://github.com/nrwl/nx/issues/22445 + buildPhase = '' + runHook preBuild + faketty pnpm build + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + mkdir -p $out/share/parca + mv packages/app/web/build $out/share/parca/ui + runHook postInstall + ''; + }); +in + +buildGoModule rec { + inherit version; + + pname = "parca"; + src = parca-src; + + vendorHash = "sha256-fErrbi3iSJlkguqzL6nH+fzmjxhoYVl1qH7tqRR1F1A="; + + ldflags = [ + "-X=main.version=${version}" + "-X=main.commit=${src.rev}" + ]; + + preBuild = '' + # Copy the built UI into the right place for the Go build to embed it. + cp -r ${ui}/share/parca/ui/* ui/packages/app/web/build + ''; + + meta = { + mainProgram = "parca"; + description = "Continuous profiling for analysis of CPU and memory usage"; + homepage = "https://github.com/parca-dev/parca"; + changelog = "https://github.com/parca-dev/parca/releases/tag/v${version}"; + license = lib.licenses.asl20; + platforms = lib.platforms.linux; + maintainers = with lib.maintainers; [ jnsgruk ]; + }; +}