+aider-chat-env

This commit is contained in:
m3tam3re
2024-11-11 10:46:17 +01:00
parent 2c6c92140f
commit 8912665aa6
6 changed files with 73 additions and 0 deletions

View File

@ -0,0 +1,50 @@
{
lib,
stdenv,
python3,
zlib,
libffi,
makeWrapper,
}: let
pythonEnv = python3.withPackages (ps:
with ps; [
# Add any Python packages you want available globally here
virtualenv
]);
in
stdenv.mkDerivation rec {
pname = "aider-chat-env";
version = "0.1.0";
src = ./.;
nativeBuildInputs = [makeWrapper];
buildInputs = [pythonEnv zlib libffi];
installPhase = ''
mkdir -p $out/bin
cat > $out/bin/aider-chat-env <<EOF
#!/bin/sh
VENV_DIR="\$HOME/.aider-chat-venv"
if [ ! -d "\$VENV_DIR" ]; then
${pythonEnv}/bin/python -m venv "\$VENV_DIR"
fi
source "\$VENV_DIR/bin/activate"
python -m pip install -U aider-chat
exec "\$SHELL"
EOF
chmod +x $out/bin/aider-chat-env
'';
postFixup = ''
wrapProgram $out/bin/aider-chat-env \
--prefix PATH : ${lib.makeBinPath buildInputs} \
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [stdenv.cc.cc.lib zlib libffi]}
'';
meta = with lib; {
description = "Python environment with aider-chat";
license = licenses.mit;
platforms = platforms.all;
};
}

View File

@ -1,4 +1,5 @@
{pkgs, ...}: {
# Define your custom packages here
zellij-ps = pkgs.callPackage ./zellij-ps {};
aider-chat-env = pkgs.callPackage ./aider-chat-env {};
}