Hello, I’m trying to make a derivation that builds my PHP (Laravel) application.
Here’s the code of one of my attampts:
{ php83 }: php83.buildComposerProject (finalAttrs: {
pname = "yota-laravel";
version = "2.0.0";
src = ./.;
php = php83.buildEnv {
extensions = ( { enabled, all }: enabled );
};
composerLock = ./composer.lock;
vendorHash = "sha256-vYuWiX3YxS6ZZ3ngsYDuR6ydggBBwBG8K+KRBP8UqrA=";
buildPhase = ''
php artisan config:cache
php artisan route:cache
php artisan view:cache
'';
})
And here’s the log:
@nix { "action": "setPhase", "phase": "unpackPhase" }
Running phase: unpackPhase
unpacking source archive /nix/store/526b8lc3pb2zqnnaifzicpvn9a1d5kan-bd7bkkzyplxc172ris1gad3idnc75a5i-source
source root is bd7bkkzyplxc172ris1gad3idnc75a5i-source
@nix { "action": "setPhase", "phase": "patchPhase" }
Running phase: patchPhase
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
Running phase: updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "configurePhase" }
Running phase: configurePhase
Executing composerInstallConfigureHook
Validating consistency between composer.lock and /nix/store/gawqdzilggwhlrscxi4df66v8b9n4qrk-yota-laravel-2.0.0-composer-repository/composer.lock
Finished composerInstallConfigureHook
@nix { "action": "setPhase", "phase": "buildPhase" }
Running phase: buildPhase
Warning: require(/build/bd7bkkzyplxc172ris1gad3idnc75a5i-source/vendor/autoload.php): Failed to open stream: No such file or directory in /build/bd7bkkzyplxc172ris1gad3idnc75a5i-source/artisan on line 18
Fatal error: Uncaught Error: Failed opening required '/build/bd7bkkzyplxc172ris1gad3idnc75a5i-source/vendor/autoload.php' (include_path='.:/nix/store/lcry86ga2mj77gfddcl10w7mccpq62q4-php-8.3.4/lib/php') in /build/bd7bkkzyplxc172ris1gad3idnc75a5i-source/artisan:18
Stack trace:
#0 {main}
thrown in /build/bd7bkkzyplxc172ris1gad3idnc75a5i-source/artisan on line 18
If I remove the buildPhase
, the project builds, but I need php artisan
commands for the application to actually work when I serve it using Nginx…