Skip to content

Commit

Permalink
🔨 improvements for running tests etc. from flake (#1887)
Browse files Browse the repository at this point in the history
  • Loading branch information
NyCodeGHG authored Oct 4, 2023
1 parent f7d1828 commit 811565b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ MIX_APP_NAME=Träwelling
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
APP_URL=http://localhost:8000
FORCE_HTTPS=false

L5_SWAGGER_CONST_HOST=http://localhost:8000/api/v1
Expand Down
16 changes: 15 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
...
}: {
devenv.shells.default = {config, ...}: {
# See https://github.com/cachix/devenv/issues/528#issuecomment-1556108767
containers = lib.mkForce {};
languages = {
php.enable = true;
javascript.enable = true;
Expand Down Expand Up @@ -49,6 +51,11 @@
php = "${config.languages.php.package}/bin/php";
npm = "${config.languages.javascript.package}/bin/npm";
mysql = config.services.mysql.package;

envKeys = builtins.attrNames config.env;
unsetEnv = builtins.concatStringsSep "\n" (
map (key: "unset ${key}") envKeys
);
in {
setup-devenv.exec = ''
set -eo pipefail
Expand Down Expand Up @@ -83,9 +90,16 @@
${php} artisan passport:install > /dev/null
'';
serve.exec = ''
APP_URL=http://localhost:8000 ${npm} run dev &
# Unset .env variables, so laravel reads the .env files by itself
${unsetEnv}
${npm} run dev &
${php} artisan serve
'';
artisan.exec = ''
# Unset .env variables, so laravel reads the .env files by itself
${unsetEnv}
exec ${php} artisan $@
'';
};
};
formatter = pkgs.alejandra;
Expand Down

0 comments on commit 811565b

Please sign in to comment.