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;