From 500b491a25e8f0838c077f528d2cce661df9ecba Mon Sep 17 00:00:00 2001 From: Mostly Void <7rat13@gmail.com> Date: Tue, 7 Feb 2023 19:06:09 +0530 Subject: [PATCH 1/2] python3Packages.sentence-transformers: init at 2.2.2 --- .../sentence-transformers/default.nix | 53 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 55 insertions(+) create mode 100644 pkgs/development/python-modules/sentence-transformers/default.nix diff --git a/pkgs/development/python-modules/sentence-transformers/default.nix b/pkgs/development/python-modules/sentence-transformers/default.nix new file mode 100644 index 000000000000..4554b36d1207 --- /dev/null +++ b/pkgs/development/python-modules/sentence-transformers/default.nix @@ -0,0 +1,53 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, huggingface-hub +, nltk +, numpy +, scikit-learn +, scipy +, sentencepiece +, tokenizers +, torch +, torchvision +, tqdm +, transformers +}: + +buildPythonPackage rec { + pname = "sentence-transformers"; + version = "2.2.2"; + format = "setuptools"; + + src = fetchFromGitHub { + owner = "UKPLab"; + repo = "sentence-transformers"; + rev = "v${version}"; + hash = "sha256-hEYpDAL0lliaS1j+c5vaZ0q1hw802jfTUurx/FvgY9w="; + }; + + propagatedBuildInputs = [ + huggingface-hub + nltk + numpy + scikit-learn + scipy + sentencepiece + tokenizers + torch + torchvision + tqdm + transformers + ]; + + pythonImportsCheck = [ "sentence_transformers" ]; + + doCheck = false; # tests fail at build_ext + + meta = with lib; { + description = "Multilingual Sentence & Image Embeddings with BERT"; + homepage = "https://github.com/UKPLab/sentence-transformers"; + license = licenses.asl20; + maintainers = with maintainers; [ dit7ya ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index c672707b90ef..988f7e71981c 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -10413,6 +10413,8 @@ self: super: with self; { inherit (pkgs) sentencepiece; }; + sentence-transformers = callPackage ../development/python-modules/sentence-transformers { }; + sentinel = callPackage ../development/python-modules/sentinel { }; sentinels = callPackage ../development/python-modules/sentinels { }; From ea9515008223ad099e5a636450283d97083d6ecb Mon Sep 17 00:00:00 2001 From: Mostly Void <7rat13@gmail.com> Date: Tue, 7 Feb 2023 19:09:21 +0530 Subject: [PATCH 2/2] khoj: init at 0.2.5 --- pkgs/servers/search/khoj/default.nix | 75 ++++++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 77 insertions(+) create mode 100644 pkgs/servers/search/khoj/default.nix diff --git a/pkgs/servers/search/khoj/default.nix b/pkgs/servers/search/khoj/default.nix new file mode 100644 index 000000000000..db20f0e920cf --- /dev/null +++ b/pkgs/servers/search/khoj/default.nix @@ -0,0 +1,75 @@ +{ lib +, fetchFromGitHub +, python3Packages +, qt6 +}: + +python3Packages.buildPythonApplication rec { + pname = "khoj"; + version = "0.2.5"; + format = "setuptools"; + + src = fetchFromGitHub { + owner = "debanjum"; + repo = "khoj"; + rev = version; + hash = "sha256-cylZNRyHMFJiBjlEtKMpRjRjwQyb7pgOjMtxFhKFU4k="; + }; + + propagatedBuildInputs = with python3Packages; [ + aiofiles + dateparser + defusedxml + fastapi + huggingface-hub + jinja2 + numpy + openai + pillow + pydantic + pyqt6 + pyyaml + schedule + sentence-transformers + torch + torchvision + transformers + uvicorn + ]; + + buildInputs = with qt6; [ + qtwayland + ]; + + nativeBuildInputs = with qt6; [ + wrapQtAppsHook + ]; + + checkInputs = with python3Packages; [ + pytest + ]; + + postPatch = '' + substituteInPlace setup.py \ + --replace "aiofiles == 0.8.0" "aiofiles >= 0.8.0" \ + --replace "openai == 0.20.0" "openai >= 0.20.0" \ + --replace "pytest == 7.1.2" "pytest >= 7.1.2" \ + --replace "fastapi == 0.77.1" "fastapi >= 0.77.1" \ + --replace "numpy == 1.22.4" "numpy >= 1.22.4" \ + --replace "huggingface_hub == 0.8.1" "huggingface_hub >= 0.8.1" \ + --replace "dateparser == 1.1.1" "dateparser >= 1.1.1" \ + --replace "sentence-transformers == 2.1.0" "sentence-transformers >= 2.1.0" \ + --replace "transformers == 4.21.0" "transformers >= 4.21.0" \ + --replace "torchvision == 0.14.1" "torchvision" \ + --replace "pydantic == 1.9.1" "pydantic >= 1.9.1" \ + --replace "pyqt6 == 6.3.1" "pyqt6 >= 6.3.1" \ + --replace "uvicorn == 0.17.6" "uvicorn >= 0.17.6" + ''; + + meta = with lib; { + description = "Natural Language Search Assistant for your Org-Mode and Markdown notes, Beancount transactions and Photos"; + homepage = "https://github.com/debanjum/khoj"; + license = licenses.gpl3Only; + maintainers = with maintainers; [ dit7ya ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 170a9195d1f1..dd7b79297311 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -30628,6 +30628,8 @@ with pkgs; khal = callPackage ../applications/misc/khal { }; + khoj = callPackage ../servers/search/khoj { }; + khard = callPackage ../applications/misc/khard { }; kid3 = libsForQt5.callPackage ../applications/audio/kid3 { };