diff --git a/shell.nix b/shell.nix index a9e35d0..ca55b7d 100644 --- a/shell.nix +++ b/shell.nix @@ -1,28 +1,38 @@ { pkgs ? import { } }: -with pkgs.python37Packages; +with pkgs; -pkgs.mkShell { +mkShell { buildInputs = [ # Dependencies - fastapi - uvicorn - pydantic - email_validator - sqlalchemy - pymysql - databases - aiomysql - alembic - pytest - twilio + python38Packages.fastapi + python38Packages.uvicorn + python38Packages.pydantic + python38Packages.email_validator + python38Packages.sqlalchemy + python38Packages.pymysql + python38Packages.databases + python38Packages.aiomysql + python38Packages.alembic + python38Packages.pytest + python38Packages.twilio + mysql57 # Development tools - black - isort - pyflakes + python38Packages.black + python38Packages.isort + python38Packages.pyflakes python-language-server - pyls-black - pyls-isort - pyls-mypy ]; + + shellHook = '' + pkill mysql + rm -rf .mysql && mkdir .mysql + + mysqld --datadir="$(pwd)/.mysql" --socket="$(pwd)/.mysql/mysql.sock" --initialize-insecure + mysqld --datadir="$(pwd)/.mysql" --socket="$(pwd)/.mysql/mysql.sock" --skip-networking & sleep 1 + + mysql --socket="$(pwd)/.mysql/mysql.sock" -u root < $(pwd)/assets/test_db.sql + + alias mysql='mysql --socket="$(pwd)/.mysql/mysql.sock" -u root' + ''; }