From cec3ba95805b08b751043f91deac1a8ee985977e Mon Sep 17 00:00:00 2001 From: Ethan Carter Edwards Date: Mon, 8 Jun 2026 17:20:34 -0700 Subject: [PATCH] leetgpu: init at 1.2.0 Homepage: https://leetgpu.com/cli Signed-off-by: Ethan Carter Edwards --- pkgs/by-name/le/leetgpu/package.nix | 74 +++++++++++++++++++++++++++++ pkgs/by-name/le/leetgpu/update.sh | 24 ++++++++++ 2 files changed, 98 insertions(+) create mode 100644 pkgs/by-name/le/leetgpu/package.nix create mode 100755 pkgs/by-name/le/leetgpu/update.sh diff --git a/pkgs/by-name/le/leetgpu/package.nix b/pkgs/by-name/le/leetgpu/package.nix new file mode 100644 index 000000000000..c1225e123892 --- /dev/null +++ b/pkgs/by-name/le/leetgpu/package.nix @@ -0,0 +1,74 @@ +{ + lib, + stdenvNoCC, + fetchurl, + installShellFiles, + versionCheckHook, +}: + +let + version = "1.2.0"; + + throwSystem = throw "Unsupported system: ${stdenvNoCC.hostPlatform.system}"; + + srcs = { + x86_64-linux = fetchurl { + url = "https://cli.leetgpu.com/dist/${version}/leetgpu-linux-amd64"; + hash = "sha256-um+KHqE1mmx7dkKm3pecrZSnsT+vbMh95kWQAsLGxFw="; + }; + + aarch64-linux = fetchurl { + url = "https://cli.leetgpu.com/dist/${version}/leetgpu-linux-arm64"; + hash = "sha256-3BcM0SHBugv/72iznR0q6t18B+u1f2auyUK1n1t5KBY="; + }; + + aarch64-darwin = fetchurl { + url = "https://cli.leetgpu.com/dist/${version}/leetgpu-macos-arm64"; + hash = "sha256-B1Sdyw+6fDBKS3PsINmiNA9PnOtEpDZiodFPsx+qk1Y="; + }; + + x86_64-darwin = fetchurl { + url = "https://cli.leetgpu.com/dist/${version}/leetgpu-macos-amd64"; + hash = "sha256-Iw2w0qDddM38OE37mVZ4krRTqjKGhXPxZSCav+oM1ac="; + }; + }; + + src = srcs.${stdenvNoCC.hostPlatform.system} or throwSystem; +in + +stdenvNoCC.mkDerivation (finalAttrs: { + pname = "leetgpu"; + inherit version; + + strictDeps = true; + __structuredAttrs = true; + + inherit src; + + dontUnpack = true; + dontConfigure = true; + dontBuild = true; + + installPhase = '' + runHook preInstall + + install -Dm755 ${src} $out/bin/leetgpu + + runHook postInstall + ''; + + nativeInstallCheckInputs = [ versionCheckHook ]; + versionCheckProgramArg = "version"; + doInstallCheck = true; + + passthru.updateScript = ./update.sh; + + meta = { + description = "Run CUDA kernels from your terminal"; + homepage = "https://leetgpu.com/cli"; + license = lib.licenses.unfree; + sourceProvenance = [ lib.sourceTypes.binaryNativeCode ]; + maintainers = with lib.maintainers; [ ethancedwards8 ]; + mainProgram = "leetgpu"; + }; +}) diff --git a/pkgs/by-name/le/leetgpu/update.sh b/pkgs/by-name/le/leetgpu/update.sh new file mode 100755 index 000000000000..6a1f26c5d462 --- /dev/null +++ b/pkgs/by-name/le/leetgpu/update.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p bash nix-update common-updater-scripts nix jq + +set -euo pipefail + +currentVersion=$(nix-instantiate --eval --raw -E "with import ./. {}; leetgpu.version or (lib.getVersion leetgpu)") +latestVersion=$(curl https://cli.leetgpu.com/latest) + +if [[ "$currentVersion" == "$latestVersion" ]]; then + echo "package is up-to-date: $currentVersion" + exit 0 +fi + +update-source-version leetgpu $latestVersion || true + +for system in \ + x86_64-linux \ + aarch64-linux \ + x86_64-darwin \ + aarch64-darwin; do + hash=$(nix store prefetch-file --json --hash-type sha256 \ + $(nix-instantiate --eval --raw -E "with import ./. {}; leetgpu.src.url" --system "$system") | jq -r '.hash') + update-source-version leetgpu $latestVersion $hash --system=$system --ignore-same-version +done