Spawn a MySQL instance with a test database

This commit is contained in:
coolneng 2020-06-21 15:58:43 +02:00
parent 78b4dd3827
commit deda3b51b5
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
1 changed files with 29 additions and 19 deletions

View File

@ -1,28 +1,38 @@
{ pkgs ? import <nixpkgs> { } }:
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'
'';
}