nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildGoModule,
4 fetchgit,
5 writeShellScript,
6 unstableGitUpdater,
7 sd,
8}:
9
10buildGoModule rec {
11 pname = "goperf";
12 version = "0-unstable-2026-01-12";
13
14 src = fetchgit {
15 url = "https://go.googlesource.com/perf";
16 rev = "5abaabe9f1bd66f90f8a5c17cb71183db0d81820";
17 hash = "sha256-76fYE6cr2L9nTW9QA79GtHmuDy3bM85glVcy4gN94qk=";
18 };
19
20 vendorHash = "sha256-bBL9YUwhnUWBnEykFoSoc7d8wOnEtfiF0aW5cqYzm5U=";
21
22 passthru.updateScript = writeShellScript "update-goperf" ''
23 export UPDATE_NIX_ATTR_PATH=goperf
24 ${lib.escapeShellArgs (unstableGitUpdater {
25 inherit (src) url;
26 })}
27 set -x
28 oldhash="$(nix-instantiate . --eval --strict -A "goperf.goModules.drvAttrs.outputHash" | cut -d'"' -f2)"
29 newhash="$(nix-build -A goperf.goModules --no-out-link 2>&1 | tail -n3 | grep 'got:' | cut -d: -f2- | xargs echo || true)"
30 fname="$(nix-instantiate --eval -E 'with import ./. {}; (builtins.unsafeGetAttrPos "version" goperf).file' | cut -d'"' -f2)"
31 ${lib.getExe sd} --string-mode "$oldhash" "$newhash" "$fname"
32 '';
33
34 meta = {
35 description = "Tools and packages for analyzing Go benchmark results";
36 homepage = "https://cs.opensource.google/go/x/perf";
37 license = lib.licenses.bsd3;
38 platforms = lib.platforms.all;
39 maintainers = with lib.maintainers; [ pbsds ];
40 };
41}