diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 54de059cf5601..1143ce6436b88 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -20990,6 +20990,14 @@ github = "tirimia"; githubId = 11174371; }; + titaniumtown = { + email = "titaniumtown@proton.me"; + name = "Simon Gardling"; + github = "titaniumtown"; + githubId = 11786225; + matrix = "@titaniumtown:envs.net"; + keys = [ { fingerprint = "D15E 4754 FE1A EDA1 5A6D 4702 9AB2 8AC1 0ECE 533D"; } ]; + }; tjni = { email = "43ngvg@masqt.com"; matrix = "@tni:matrix.org"; diff --git a/pkgs/by-name/gp/gpt4all/embedding-local.patch b/pkgs/by-name/gp/gpt4all/embedding-local.patch new file mode 100644 index 0000000000000..fee7702102ac8 --- /dev/null +++ b/pkgs/by-name/gp/gpt4all/embedding-local.patch @@ -0,0 +1,50 @@ +commit 1e8fdf3f90fd142c5ddd63e44ca1e5c172dbfb7f +Author: Simon Gardling +Date: Tue Aug 27 12:45:14 2024 -0400 + + use locally downloaded embeddings + +index 27f3f5d9..9e25528a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -90,6 +90,7 @@ elseif (APPLE) + endif() + + # Embedding model ++#[[ + set(LOCAL_EMBEDDING_MODEL "nomic-embed-text-v1.5.f16.gguf") + set(LOCAL_EMBEDDING_MODEL_MD5 "a5401e7f7e46ed9fcaed5b60a281d547") + set(LOCAL_EMBEDDING_MODEL_PATH "${CMAKE_BINARY_DIR}/resources/${LOCAL_EMBEDDING_MODEL}") +@@ -104,6 +105,7 @@ + if (APPLE) + list(APPEND CHAT_EXE_RESOURCES "${LOCAL_EMBEDDING_MODEL_PATH}") + endif() ++]] + + qt_add_executable(chat + main.cpp +@@ -383,11 +385,13 @@ + endif() + endif() + ++#[[ + if (NOT APPLE) + install(FILES "${CMAKE_BINARY_DIR}/resources/${LOCAL_EMBEDDING_MODEL}" + DESTINATION resources + COMPONENT ${COMPONENT_NAME_MAIN}) + endif() ++]] + + set(CPACK_GENERATOR "IFW") + set(CPACK_VERBATIM_VARIABLES YES) +--- a/embllm.cpp ++++ b/embllm.cpp +@@ -84,7 +84,7 @@ bool EmbeddingLLMWorker::loadModel() + + QString filePath = embPathFmt.arg(QCoreApplication::applicationDirPath(), LOCAL_EMBEDDING_MODEL); + if (!QFileInfo::exists(filePath)) { +- qWarning() << "embllm WARNING: Local embedding model not found"; ++ qWarning() << "embllm WARNING: Local embedding model not found: " << filePath; + return false; + } + diff --git a/pkgs/by-name/gp/gpt4all/package.nix b/pkgs/by-name/gp/gpt4all/package.nix index 60a6e05de211b..893e3594bc50b 100644 --- a/pkgs/by-name/gp/gpt4all/package.nix +++ b/pkgs/by-name/gp/gpt4all/package.nix @@ -2,6 +2,7 @@ , config , stdenv , fetchFromGitHub +, fetchurl , cmake , qt6 , fmt @@ -14,16 +15,25 @@ stdenv.mkDerivation (finalAttrs: { pname = "gpt4all"; - version = "2.8.0"; + version = "3.2.1"; src = fetchFromGitHub { fetchSubmodules = true; - hash = "sha256-aSz37+1K26Xizf4cpV45a2DnSsl959VQok/ppFRk/hs="; + hash = "sha256-h6hcqafTjQsqVlpnqVeohh38A67VSGrW3WrCErjaKIQ="; owner = "nomic-ai"; repo = "gpt4all"; rev = "v${finalAttrs.version}"; }; + embed_model = fetchurl { + url = "https://gpt4all.io/models/gguf/nomic-embed-text-v1.5.f16.gguf"; + sha256 = "f7af6f66802f4df86eda10fe9bbcfc75c39562bed48ef6ace719a251cf1c2fdb"; + }; + + patches = [ + ./embedding-local.patch + ]; + sourceRoot = "${finalAttrs.src.name}/gpt4all-chat"; nativeBuildInputs = [ @@ -41,6 +51,7 @@ stdenv.mkDerivation (finalAttrs: { qt6.qthttpserver qt6.qtwebengine qt6.qt5compat + qt6.qttools shaderc vulkan-headers wayland @@ -64,8 +75,9 @@ stdenv.mkDerivation (finalAttrs: { rm -rf $out/include rm -rf $out/lib/*.a mv $out/bin/chat $out/bin/${finalAttrs.meta.mainProgram} + install -D ${finalAttrs.embed_model} $out/resources/nomic-embed-text-v1.5.f16.gguf install -m 444 -D $src/gpt4all-chat/flatpak-manifest/io.gpt4all.gpt4all.desktop $out/share/applications/io.gpt4all.gpt4all.desktop - install -m 444 -D $src/gpt4all-chat/icons/logo.svg $out/share/icons/hicolor/scalable/apps/io.gpt4all.gpt4all.svg + install -m 444 -D $src/gpt4all-chat/icons/nomic_logo.svg $out/share/icons/hicolor/scalable/apps/io.gpt4all.gpt4all.svg substituteInPlace $out/share/applications/io.gpt4all.gpt4all.desktop \ --replace-fail 'Exec=chat' 'Exec=${finalAttrs.meta.mainProgram}' ''; @@ -76,6 +88,6 @@ stdenv.mkDerivation (finalAttrs: { homepage = "https://github.com/nomic-ai/gpt4all"; license = lib.licenses.mit; mainProgram = "gpt4all"; - maintainers = with lib.maintainers; [ polygon ]; + maintainers = with lib.maintainers; [ polygon titaniumtown ]; }; })