+aider-chat-env
This commit is contained in:
50
pkgs/aider-chat-env/default.nix
Normal file
50
pkgs/aider-chat-env/default.nix
Normal 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;
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user