From 5198dc50163e15b9968b360e5a9922f8825984a2 Mon Sep 17 00:00:00 2001 From: coolneng Date: Tue, 26 May 2020 19:42:16 +0200 Subject: [PATCH] Add MySql environment --- env/mysql.nix | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 env/mysql.nix 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' + ''; +}