Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 stdenv, 3 buildGoModule, 4 lib, 5 fetchFromGitHub, 6 versionCheckHook, 7 installShellFiles, 8 nix-update-script, 9 ... 10}: 11 12buildGoModule (finalAttrs: { 13 pname = "pyroscope"; 14 version = "1.13.4"; 15 16 src = fetchFromGitHub { 17 owner = "grafana"; 18 repo = "pyroscope"; 19 rev = "v1.13.4"; 20 hash = "sha256-nyb91BO4zzJl3AG/ojBO+q7WiicZYmOtztW6FTlQHMM="; 21 }; 22 23 vendorHash = "sha256-GZMoXsoE3pL0T3tkWY7i1f9sGy5uVDqeurCvBteqV9A="; 24 proxyVendor = true; 25 26 subPackages = [ 27 "cmd/pyroscope" 28 "cmd/profilecli" 29 ]; 30 31 ldflags = [ 32 "-X=github.com/grafana/pyroscope/pkg/util/build.Branch=${finalAttrs.src.rev}" 33 "-X=github.com/grafana/pyroscope/pkg/util/build.Version=${finalAttrs.version}" 34 "-X=github.com/grafana/pyroscope/pkg/util/build.Revision=${finalAttrs.src.rev}" 35 "-X=github.com/grafana/pyroscope/pkg/util/build.BuildDate=1970-01-01T00:00:00Z" 36 ]; 37 38 # We're overriding the version in 'ldFlags', so we should check that the 39 # derivation 'version' string is found in 'pyroscope --version'. 40 nativeInstallCheckInputs = [ versionCheckHook ]; 41 doInstallCheck = true; 42 versionCheckProgram = "${placeholder "out"}/bin/${finalAttrs.meta.mainProgram}"; 43 versionCheckProgramArg = "--version"; 44 45 nativeBuildInputs = [ installShellFiles ]; 46 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' 47 installShellCompletion --cmd pyroscope \ 48 --bash <($out/bin/pyroscope completion bash) \ 49 --fish <($out/bin/pyroscope completion fish) \ 50 --zsh <($out/bin/pyroscope completion zsh) 51 ''; 52 53 passthru.updateScript = nix-update-script { }; 54 55 meta = { 56 description = "Continuous profiling platform; debug performance issues down to a single line of code"; 57 homepage = "https://github.com/grafana/pyroscope"; 58 changelog = "https://github.com/grafana/pyroscope/blob/${finalAttrs.src.rev}/CHANGELOG.md"; 59 license = lib.licenses.agpl3Only; 60 maintainers = [ lib.teams.mercury ]; 61 mainProgram = "pyroscope"; 62 }; 63})