This commit is contained in:
Lennart J. Kurzweg (Nx2)
2024-08-02 16:53:23 +02:00
commit 0b0c326804
7 changed files with 1957 additions and 0 deletions

19
.direnv/bin/nix-direnv-reload Executable file
View File

@@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -e
if [[ ! -d "/home/nx2/test-small-llms" ]]; then
echo "Cannot find source directory; Did you move it?"
echo "(Looking for "/home/nx2/test-small-llms")"
echo 'Cannot force reload with this script - use "direnv reload" manually and then try again'
exit 1
fi
# rebuild the cache forcefully
_nix_direnv_force_reload=1 direnv exec "/home/nx2/test-small-llms" true
# Update the mtime for .envrc.
# This will cause direnv to reload again - but without re-building.
touch "/home/nx2/test-small-llms/.envrc"
# Also update the timestamp of whatever profile_rc we have.
# This makes sure that we know we are up to date.
touch -r "/home/nx2/test-small-llms/.envrc" "/home/nx2/test-small-llms/.direnv"/*.rc

View File

@@ -0,0 +1 @@
/nix/store/j2vf461mp9h2y9awkklbfawf3dz7cs1p-nix-shell-env

File diff suppressed because it is too large Load Diff

1
.envrc Normal file
View File

@@ -0,0 +1 @@
use nix

3
.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
.venv
__pycache
.vscode

3
requirements.txt Normal file
View File

@@ -0,0 +1,3 @@
langchain
langchain-core
langchain-ollama

35
shell.nix Normal file
View File

@@ -0,0 +1,35 @@
{ pkgs ? import <nixpkgs> { } }:
let
my-python = pkgs.python312;
python-with-my-packages = my-python.withPackages
(p: with p; [
]);
lib-path = with pkgs; lib.makeLibraryPath [
libffi
openssl
stdenv.cc.cc
];
in pkgs.mkShell {
buildInputs = [
python-with-my-packages
];
shellHook = ''
SOURCE_DATE_EPOCH=$(date +%s)
export "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${lib-path}"
VENV=.venv
if test ! -d $VENV; then
python3 -m venv $VENV
fi
source ./$VENV/bin/activate
export PYTHONPATH=`pwd`/$VENV/${python-with-my-packages.sitePackages}/
# export PYTHONPATH=`pwd`/$VENV/${python-with-my-packages.sitePackages}/:$PYTHONPATH
pip install -r requirements.txt
'';
postShellHook = ''
ln -sf ${python-with-my-packages.sitePackages}/* ./.venv/lib/python3.12/site-packages
'';
}