From 64bb4f9bf17f61cb851ea90f5e7d5a57904b4fde Mon Sep 17 00:00:00 2001 From: jkachmar Date: Tue, 17 Jun 2025 22:41:46 -0400 Subject: [PATCH 1/2] pyroscope: init at 1.13.4 --- pkgs/by-name/py/pyroscope/package.nix | 45 +++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 pkgs/by-name/py/pyroscope/package.nix diff --git a/pkgs/by-name/py/pyroscope/package.nix b/pkgs/by-name/py/pyroscope/package.nix new file mode 100644 index 000000000000..0f9422f598fe --- /dev/null +++ b/pkgs/by-name/py/pyroscope/package.nix @@ -0,0 +1,45 @@ +{ + buildGoModule, + lib, + fetchFromGitHub, + nix-update-script, + ... +}: + +buildGoModule (finalAttrs: { + pname = "pyroscope"; + version = "1.13.4"; + + src = fetchFromGitHub { + owner = "grafana"; + repo = "pyroscope"; + rev = "v1.13.4"; + hash = "sha256-nyb91BO4zzJl3AG/ojBO+q7WiicZYmOtztW6FTlQHMM="; + }; + + vendorHash = "sha256-GZMoXsoE3pL0T3tkWY7i1f9sGy5uVDqeurCvBteqV9A="; + proxyVendor = true; + + subPackages = [ + "cmd/pyroscope" + "cmd/profilecli" + ]; + + ldflags = [ + "-X=github.com/grafana/pyroscope/pkg/util/build.Branch=${finalAttrs.src.rev}" + "-X=github.com/grafana/pyroscope/pkg/util/build.Version=${finalAttrs.version}" + "-X=github.com/grafana/pyroscope/pkg/util/build.Revision=${finalAttrs.src.rev}" + "-X=github.com/grafana/pyroscope/pkg/util/build.BuildDate=1970-01-01T00:00:00Z" + ]; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "Continuous Profiling Platform. Debug performance issues down to a single line of code"; + homepage = "https://github.com/grafana/pyroscope"; + changelog = "https://github.com/grafana/pyroscope/blob/${finalAttrs.src.rev}/CHANGELOG.md"; + license = lib.licenses.agpl3Only; + maintainers = [ lib.teams.mercury ]; + mainProgram = "pyroscope"; + }; +}) From 6fb2de92136f4839c44c31021868a51a849e45dd Mon Sep 17 00:00:00 2001 From: jkachmar Date: Tue, 17 Jun 2025 23:46:53 -0400 Subject: [PATCH 2/2] pyroscope: address review feedback --- pkgs/by-name/py/pyroscope/package.nix | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/py/pyroscope/package.nix b/pkgs/by-name/py/pyroscope/package.nix index 0f9422f598fe..aa3269d674b1 100644 --- a/pkgs/by-name/py/pyroscope/package.nix +++ b/pkgs/by-name/py/pyroscope/package.nix @@ -1,7 +1,10 @@ { + stdenv, buildGoModule, lib, fetchFromGitHub, + versionCheckHook, + installShellFiles, nix-update-script, ... }: @@ -32,10 +35,25 @@ buildGoModule (finalAttrs: { "-X=github.com/grafana/pyroscope/pkg/util/build.BuildDate=1970-01-01T00:00:00Z" ]; + # We're overriding the version in 'ldFlags', so we should check that the + # derivation 'version' string is found in 'pyroscope --version'. + nativeInstallCheckInputs = [ versionCheckHook ]; + doInstallCheck = true; + versionCheckProgram = "${placeholder "out"}/bin/${finalAttrs.meta.mainProgram}"; + versionCheckProgramArg = "--version"; + + nativeBuildInputs = [ installShellFiles ]; + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + installShellCompletion --cmd pyroscope \ + --bash <($out/bin/pyroscope completion bash) \ + --fish <($out/bin/pyroscope completion fish) \ + --zsh <($out/bin/pyroscope completion zsh) + ''; + passthru.updateScript = nix-update-script { }; meta = { - description = "Continuous Profiling Platform. Debug performance issues down to a single line of code"; + description = "Continuous profiling platform; debug performance issues down to a single line of code"; homepage = "https://github.com/grafana/pyroscope"; changelog = "https://github.com/grafana/pyroscope/blob/${finalAttrs.src.rev}/CHANGELOG.md"; license = lib.licenses.agpl3Only;