From a34ed79eaa76c75b562507ccdd8ae7440263a29a Mon Sep 17 00:00:00 2001 From: Elliot Cameron Date: Fri, 8 Dec 2023 11:22:32 -0500 Subject: [PATCH 1/4] tabby: init at 0.6.0 --- pkgs/development/tools/tabby/default.nix | 41 ++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 43 insertions(+) create mode 100644 pkgs/development/tools/tabby/default.nix diff --git a/pkgs/development/tools/tabby/default.nix b/pkgs/development/tools/tabby/default.nix new file mode 100644 index 000000000000..31c56fa61ad2 --- /dev/null +++ b/pkgs/development/tools/tabby/default.nix @@ -0,0 +1,41 @@ +{ 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; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5e351d8e7fb5..6f9cb3c70819 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6431,6 +6431,8 @@ with pkgs; recyclarr = callPackage ../tools/video/recyclarr { }; + tabby = callPackage ../development/tools/tabby { }; + tsduck = callPackage ../tools/video/tsduck { }; turso-cli = callPackage ../development/tools/turso-cli {}; From cfec6d9203a461d9d698d8a60ef003cac6d0da94 Mon Sep 17 00:00:00 2001 From: Will Owens Date: Tue, 27 Feb 2024 00:49:41 -0500 Subject: [PATCH 2/4] tabby: add nvidia cuda support --- maintainers/maintainer-list.nix | 9 +++ pkgs/by-name/ta/tabby/package.nix | 73 ++++++++++++++++++++++++ pkgs/development/tools/tabby/default.nix | 41 ------------- pkgs/top-level/all-packages.nix | 2 - 4 files changed, 82 insertions(+), 43 deletions(-) create mode 100644 pkgs/by-name/ta/tabby/package.nix delete mode 100644 pkgs/development/tools/tabby/default.nix diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 116fc5dbab22..51e3a51c2c68 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -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"; diff --git a/pkgs/by-name/ta/tabby/package.nix b/pkgs/by-name/ta/tabby/package.nix new file mode 100644 index 000000000000..445bf22caef3 --- /dev/null +++ b/pkgs/by-name/ta/tabby/package.nix @@ -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 ]; + }; +} diff --git a/pkgs/development/tools/tabby/default.nix b/pkgs/development/tools/tabby/default.nix deleted file mode 100644 index 31c56fa61ad2..000000000000 --- a/pkgs/development/tools/tabby/default.nix +++ /dev/null @@ -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; - }; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6f9cb3c70819..5e351d8e7fb5 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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 {}; From 52b3f4602cc50532a03da9ebd7a28fd3c819c228 Mon Sep 17 00:00:00 2001 From: Will Owens Date: Tue, 27 Feb 2024 01:12:46 -0500 Subject: [PATCH 3/4] tabby: bump to version 0.7.0 --- pkgs/by-name/ta/tabby/package.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/by-name/ta/tabby/package.nix b/pkgs/by-name/ta/tabby/package.nix index 445bf22caef3..b89434a8fc48 100644 --- a/pkgs/by-name/ta/tabby/package.nix +++ b/pkgs/by-name/ta/tabby/package.nix @@ -13,20 +13,20 @@ }: rustPlatform.buildRustPackage rec { - version = "0.6.0"; + version = "0.7.0"; pname = "tabby"; src = fetchFromGitHub { owner = "TabbyML"; repo = "tabby"; rev = "v${version}"; - hash = "sha256-cZvfJMFsf7m8o5YKpsJpcrRmxJCQOFxrDzJZXMzVeFA="; + hash = "sha256-BTPJWvqO4IuQAiUEER9PYfu4aQsz5RI77WsA/gQu5Jc="; fetchSubmodules = true; }; - cargoHash = "sha256-iv8MpBfGGUFkjUZ9eAGq65vCy62VJQGTYIS0r9GRyfo="; + cargoHash = "sha256-Du0ya9J+0tz72mSid5If0VFX2lLC7YtwNQ/MALpFv2M="; - # https://github.com/TabbyML/tabby/blob/v0.6.0/Dockerfile#L40C5-L40C58 + # https://github.com/TabbyML/tabby/blob/v0.7.0/.github/workflows/release.yml#L39 cargoBuildFlags = [ "--release" "--package" "tabby" From bc8f5cf31a4429ffe6de93e5c14d8cb992f9975b Mon Sep 17 00:00:00 2001 From: Will Owens Date: Tue, 27 Feb 2024 04:52:04 -0500 Subject: [PATCH 4/4] tabby: add vim-tabby vimPlugin --- pkgs/applications/editors/vim/plugins/generated.nix | 11 +++++++++++ pkgs/applications/editors/vim/plugins/overrides.nix | 8 ++++++++ .../applications/editors/vim/plugins/vim-plugin-names | 1 + 3 files changed, 20 insertions(+) diff --git a/pkgs/applications/editors/vim/plugins/generated.nix b/pkgs/applications/editors/vim/plugins/generated.nix index acf2363075dd..221666f07c8e 100644 --- a/pkgs/applications/editors/vim/plugins/generated.nix +++ b/pkgs/applications/editors/vim/plugins/generated.nix @@ -16827,5 +16827,16 @@ final: prev: meta.homepage = "https://github.com/jhradilek/vim-snippets/"; }; + vim-tabby = buildVimPlugin { + pname = "vim-tabby"; + version = "2024-02-01"; + src = fetchFromGitHub { + owner = "TabbyML"; + repo = "vim-tabby"; + rev = "0b62bc2ed5c7d930c7435c3504d5c18ea6379b28"; + sha256 = "06crxhvwz04s6sfj0q22kkp3g5zvip13088m95qwznw9bv2gpx3s"; + }; + meta.homepage = "https://github.com/TabbyML/vim-tabby/"; + }; } diff --git a/pkgs/applications/editors/vim/plugins/overrides.nix b/pkgs/applications/editors/vim/plugins/overrides.nix index 68ce88387fa9..34a3fdb7ceaa 100644 --- a/pkgs/applications/editors/vim/plugins/overrides.nix +++ b/pkgs/applications/editors/vim/plugins/overrides.nix @@ -1671,6 +1671,14 @@ dependencies = with self; [ vim-repeat ]; }; + vim-tabby = super.vim-tabby.overrideAttrs { + postPatch = '' + substituteInPlace autoload/tabby/globals.vim --replace-fail \ + "let g:tabby_node_binary = get(g:, 'tabby_node_binary', 'node')" \ + "let g:tabby_node_binary = get(g:, 'tabby_node_binary', '${nodejs}/bin/node')" + ''; + }; + vim-textobj-entire = super.vim-textobj-entire.overrideAttrs { dependencies = with self; [ vim-textobj-user ]; meta.maintainers = with lib.maintainers; [ farlion ]; diff --git a/pkgs/applications/editors/vim/plugins/vim-plugin-names b/pkgs/applications/editors/vim/plugins/vim-plugin-names index 8edaa88adb13..c236df4d7099 100644 --- a/pkgs/applications/editors/vim/plugins/vim-plugin-names +++ b/pkgs/applications/editors/vim/plugins/vim-plugin-names @@ -1399,3 +1399,4 @@ https://github.com/ziglang/zig.vim/,, https://github.com/mickael-menu/zk-nvim/,HEAD, https://github.com/troydm/zoomwintab.vim/,, https://github.com/nanotee/zoxide.vim/,, +https://github.com/TabbyML/vim-tabby/,HEAD,