diff options
| author | Franck Cuny <franck@fcuny.net> | 2024-12-28 13:17:45 -0800 |
|---|---|---|
| committer | Franck Cuny <franck@fcuny.net> | 2024-12-28 13:17:45 -0800 |
| commit | bd23febefcd99aae0739ecc35195fc9781939171 (patch) | |
| tree | 282508d9dfffaf3b25d5790865e665dc4604a975 /pkgs | |
| parent | remove secrets and agenix since nothing uses them (diff) | |
| download | infra-bd23febefcd99aae0739ecc35195fc9781939171.tar.gz | |
rename packages to pkgs
This is the correct convention.
Diffstat (limited to 'pkgs')
| -rw-r--r-- | pkgs/hashi/default.nix | 38 | ||||
| -rw-r--r-- | pkgs/perf-flamegraph-pid/default.nix | 35 | ||||
| -rwxr-xr-x | pkgs/perf-flamegraph-pid/perf-flamegraph-pid.sh | 20 | ||||
| -rw-r--r-- | pkgs/sapi/default.nix | 49 |
4 files changed, 142 insertions, 0 deletions
diff --git a/pkgs/hashi/default.nix b/pkgs/hashi/default.nix new file mode 100644 index 0000000..97de12a --- /dev/null +++ b/pkgs/hashi/default.nix @@ -0,0 +1,38 @@ +{ + stdenv, + fetchurl, + lib, + ... +}: +let + url = "https://artifactory.rbx.com:443/artifactory/generic-rbx-local/hashi/0.1.4/bin/hashi_darwin-amd64"; +in +stdenv.mkDerivation rec { + pname = "hashi"; + version = "0.1.4"; + src = fetchurl { + inherit url; + sha256 = "sha256-uX6AdOUfh6JEwS20kQwjp9Os12lVOGoCajOV9sYWXtA="; + }; + + installPhase = '' + mkdir -p $out/bin + cp $src $out/bin/hashi + chmod +x $out/bin/hashi + ''; + + dontUnpack = true; + dontStrip = true; + doInstallCheck = true; + + installCheckPhase = '' + $out/bin/hashi -e sitetest3 version + ''; + + meta = with lib; { + description = "hashi command-line tool"; + homepage = "http://go/hashicli"; + license = licenses.unfree; + platforms = [ "x86_64-darwin" ]; + }; +} diff --git a/pkgs/perf-flamegraph-pid/default.nix b/pkgs/perf-flamegraph-pid/default.nix new file mode 100644 index 0000000..9b3789b --- /dev/null +++ b/pkgs/perf-flamegraph-pid/default.nix @@ -0,0 +1,35 @@ +{ + lib, + stdenvNoCC, + pkgs, +}: + +stdenvNoCC.mkDerivation rec { + pname = "perf-flamegraph-pid"; + src = ./perf-flamegraph-pid.sh; + version = "0.1.0"; + + nativeBuildInputs = with pkgs; [ + flamegraph + linuxPackages_latest.perf + ]; + propagatedBuildInputs = with pkgs; [ + flamegraph + linuxPackages_latest.perf + ]; + + dontUnpack = true; + dontBuild = true; + + installPhase = '' + mkdir -p $out/bin + cp $src $out/bin/${pname} + ''; + + meta = with lib; { + description = "Generate a process' flame graph."; + license = with licenses; [ mit ]; + platforms = platforms.unix; + maintainers = with maintainers; [ fcuny ]; + }; +} diff --git a/pkgs/perf-flamegraph-pid/perf-flamegraph-pid.sh b/pkgs/perf-flamegraph-pid/perf-flamegraph-pid.sh new file mode 100755 index 0000000..2ca3d16 --- /dev/null +++ b/pkgs/perf-flamegraph-pid/perf-flamegraph-pid.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -euo pipefail + +OUT_DIR="${HOME}/workspace/debug/flamegraph" +OUT_DATA="${OUT_DIR}/$(date +%y%m%d-%H%M%S).data" +OUT_SVG="${OUT_DIR}/$(date +%y%m%d-%H%M%S).svg" + +mkdir -p "${OUT_DIR}" + +# record the data with perf. We need to run this with sudo to get all +# the privileges we need. +sudo perf record -g --call-graph dwarf --freq max --output "${OUT_DATA}" "$@" + +# give me ownership of the file +sudo chown "${USER}" "${OUT_DATA}" + +perf script --input "${OUT_DATA}" | + stackcollapse-perf.pl | + flamegraph.pl >"${OUT_SVG}" diff --git a/pkgs/sapi/default.nix b/pkgs/sapi/default.nix new file mode 100644 index 0000000..a939685 --- /dev/null +++ b/pkgs/sapi/default.nix @@ -0,0 +1,49 @@ +{ + stdenv, + fetchurl, + lib, + ... +}: +let + version = "1.2.4"; + sources = { + x86_64-darwin = { + url = "https://artifactory.rbx.com:443/artifactory/generic-rbx-local/sapi-cli/darwin-amd64/v${version}/sapi"; + sha256 = "sha256-Il/aqGzxtI84TdUAz4Fvw8RbAgGBZQPN3MZrOitrpVk="; + }; + aarch64-darwin = { + url = "https://artifactory.rbx.com:443/artifactory/generic-rbx-local/sapi-cli/darwin-arm64/v${version}/sapi"; + sha256 = "sha256-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx="; # Replace with actual SHA + }; + }; +in +stdenv.mkDerivation rec { + pname = "sapi"; + inherit version; + + src = fetchurl { + inherit (sources.${stdenv.hostPlatform.system}) + url + sha256 + ; + }; + + installPhase = '' + mkdir -p $out/bin + cp $src $out/bin/sapi + chmod +x $out/bin/sapi + ''; + + dontUnpack = true; + dontStrip = true; + + meta = with lib; { + description = "sapi command-line tool"; + homepage = "https://go/sapi"; + license = licenses.unfree; + platforms = [ + "x86_64-darwin" + "aarch64-darwin" + ]; + }; +} |
