Skip to content

Commit 811565b

Browse files
authored
🔨 improvements for running tests etc. from flake (#1887)
1 parent f7d1828 commit 811565b

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

.env.example

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ MIX_APP_NAME=Träwelling
44
APP_ENV=local
55
APP_KEY=
66
APP_DEBUG=true
7-
APP_URL=http://localhost
7+
APP_URL=http://localhost:8000
88
FORCE_HTTPS=false
99

1010
L5_SWAGGER_CONST_HOST=http://localhost:8000/api/v1

flake.nix

+15-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
...
2323
}: {
2424
devenv.shells.default = {config, ...}: {
25+
# See https://github.com/cachix/devenv/issues/528#issuecomment-1556108767
26+
containers = lib.mkForce {};
2527
languages = {
2628
php.enable = true;
2729
javascript.enable = true;
@@ -49,6 +51,11 @@
4951
php = "${config.languages.php.package}/bin/php";
5052
npm = "${config.languages.javascript.package}/bin/npm";
5153
mysql = config.services.mysql.package;
54+
55+
envKeys = builtins.attrNames config.env;
56+
unsetEnv = builtins.concatStringsSep "\n" (
57+
map (key: "unset ${key}") envKeys
58+
);
5259
in {
5360
setup-devenv.exec = ''
5461
set -eo pipefail
@@ -83,9 +90,16 @@
8390
${php} artisan passport:install > /dev/null
8491
'';
8592
serve.exec = ''
86-
APP_URL=http://localhost:8000 ${npm} run dev &
93+
# Unset .env variables, so laravel reads the .env files by itself
94+
${unsetEnv}
95+
${npm} run dev &
8796
${php} artisan serve
8897
'';
98+
artisan.exec = ''
99+
# Unset .env variables, so laravel reads the .env files by itself
100+
${unsetEnv}
101+
exec ${php} artisan $@
102+
'';
89103
};
90104
};
91105
formatter = pkgs.alejandra;

0 commit comments

Comments
 (0)