leetgpu: init at 1.2.0 (#529713)
This commit is contained in:
@@ -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";
|
||||
};
|
||||
})
|
||||
Executable
+24
@@ -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
|
||||
Reference in New Issue
Block a user