diff --git a/env/mysql.nix b/env/mysql.nix new file mode 100644 index 0000000..6e97b95 --- /dev/null +++ b/env/mysql.nix @@ -0,0 +1,21 @@ +{ pkgs ? import { } }: + +with pkgs; + +mkShell { + buildInputs = [ mysql57 ]; + + 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/db.sql + + alias phpunit="./vendor/bin/phpunit" + alias mysql='mysql --socket="$(pwd)/.mysql/mysql.sock" -u root' + ''; +}