tabby: add nvidia cuda support

This commit is contained in:
Will Owens 2024-02-27 00:49:41 -05:00
parent a34ed79eaa
commit cfec6d9203
No known key found for this signature in database
GPG Key ID: A3124B3009B47FCF
4 changed files with 82 additions and 43 deletions

View File

@ -7016,6 +7016,15 @@
github = "ghostbuster91";
githubId = 5662622;
};
ghthor = {
email = "ghthor@gmail.com";
github = "ghthor";
githubId = 160298;
name = "Will Owens";
keys = [{
fingerprint = "8E98 BB01 BFF8 AEA4 E303 FC4C 8074 09C9 2CE2 3033";
}];
};
ghuntley = {
email = "ghuntley@ghuntley.com";
github = "ghuntley";

View File

@ -0,0 +1,73 @@
{ lib
, fetchFromGitHub
, gcc12
, cmake
, git
, openssl
, pkg-config
, protobuf
, rustPlatform
, addOpenGLRunpath
, cudatoolkit
, nvidia ? true
}:
rustPlatform.buildRustPackage rec {
version = "0.6.0";
pname = "tabby";
src = fetchFromGitHub {
owner = "TabbyML";
repo = "tabby";
rev = "v${version}";
hash = "sha256-cZvfJMFsf7m8o5YKpsJpcrRmxJCQOFxrDzJZXMzVeFA=";
fetchSubmodules = true;
};
cargoHash = "sha256-iv8MpBfGGUFkjUZ9eAGq65vCy62VJQGTYIS0r9GRyfo=";
# https://github.com/TabbyML/tabby/blob/v0.6.0/Dockerfile#L40C5-L40C58
cargoBuildFlags = [
"--release"
"--package" "tabby"
] ++ lib.optional nvidia [
"--features" "cuda"
];
OPENSSL_NO_VENDOR = 1;
nativeBuildInputs = [
pkg-config
protobuf
git
cmake
gcc12
] ++ lib.optional nvidia [
addOpenGLRunpath
];
buildInputs = [ openssl ]
++ lib.optional nvidia cudatoolkit
;
postInstall = ''
${if nvidia then ''
addOpenGLRunpath "$out/bin/tabby"
'' else ''
''}
'';
# Fails with:
# file cannot create directory: /var/empty/local/lib64/cmake/Llama
doCheck = false;
meta = with lib; {
homepage = "https://github.com/TabbyML/tabby";
changelog = "https://github.com/TabbyML/tabby/releases/tag/v${version}";
description = "Self-hosted AI coding assistant";
mainProgram = "tabby";
license = licenses.asl20;
maintainers = [ maintainers.ghthor ];
};
}

View File

@ -1,41 +0,0 @@
{ lib
, fetchFromGitHub
, cmake
, git
, openssl
, pkg-config
, protobuf
, rustPlatform
}:
rustPlatform.buildRustPackage rec {
version = "0.6.0";
pname = "tabby";
src = fetchFromGitHub {
owner = "TabbyML";
repo = pname;
rev = "v${version}";
hash = "sha256-cZvfJMFsf7m8o5YKpsJpcrRmxJCQOFxrDzJZXMzVeFA=";
fetchSubmodules = true;
};
cargoHash = "sha256-iv8MpBfGGUFkjUZ9eAGq65vCy62VJQGTYIS0r9GRyfo=";
OPENSSL_NO_VENDOR = 1;
nativeBuildInputs = [ pkg-config protobuf git cmake ];
buildInputs = [ openssl ];
# Fails with:
# file cannot create directory: /var/empty/local/lib64/cmake/Llama
doCheck = false;
meta = with lib; {
description = "Self-hosted AI coding assistant";
mainProgram = "tabby";
license = licenses.asl20;
maintainers = teams.deshaw.members;
};
}

View File

@ -6431,8 +6431,6 @@ with pkgs;
recyclarr = callPackage ../tools/video/recyclarr { };
tabby = callPackage ../development/tools/tabby { };
tsduck = callPackage ../tools/video/tsduck { };
turso-cli = callPackage ../development/tools/turso-cli {};