2024-01-02 11:29:13 +00:00
|
|
|
{ lib
|
|
|
|
, buildGoModule
|
|
|
|
, fetchgit
|
|
|
|
, writeShellScript
|
|
|
|
, unstableGitUpdater
|
|
|
|
, sd
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "goperf";
|
2024-06-05 15:53:02 +00:00
|
|
|
version = "0-unstable-2024-05-10";
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
src = fetchgit {
|
|
|
|
url = "https://go.googlesource.com/perf";
|
2024-06-05 15:53:02 +00:00
|
|
|
rev = "bedb9135df6d63a551db71a3fa872a2816e90cf2";
|
|
|
|
hash = "sha256-e2dr/eeKoc0Vpxx29bmxhfYsj13oEFs9h1/mBmDbWM4=";
|
2024-01-02 11:29:13 +00:00
|
|
|
};
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
vendorHash = "sha256-MtDvOn+cjlEtObzmYnsQa2BkgIeKr/j18wk5QK3JDuk=";
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
passthru.updateScript = writeShellScript "update-goperf" ''
|
|
|
|
export UPDATE_NIX_ATTR_PATH=goperf
|
|
|
|
${lib.escapeShellArgs (unstableGitUpdater { inherit (src) url; })}
|
|
|
|
set -x
|
2024-05-15 15:35:15 +00:00
|
|
|
oldhash="$(nix-instantiate . --eval --strict -A "goperf.goModules.drvAttrs.outputHash" | cut -d'"' -f2)"
|
|
|
|
newhash="$(nix-build -A goperf.goModules --no-out-link 2>&1 | tail -n3 | grep 'got:' | cut -d: -f2- | xargs echo || true)"
|
2024-01-02 11:29:13 +00:00
|
|
|
fname="$(nix-instantiate --eval -E 'with import ./. {}; (builtins.unsafeGetAttrPos "version" goperf).file' | cut -d'"' -f2)"
|
|
|
|
${lib.getExe sd} --string-mode "$oldhash" "$newhash" "$fname"
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Tools and packages for analyzing Go benchmark results";
|
|
|
|
homepage = "https://cs.opensource.google/go/x/perf";
|
|
|
|
license = licenses.bsd3;
|
|
|
|
platforms = platforms.all;
|
|
|
|
maintainers = with maintainers; [ pbsds ];
|
|
|
|
};
|
|
|
|
}
|