Repository navigation
fix(php plugin): reference php output via explicit flake fragment - #2900
Conversation
The php plugin's generated flake exports two packages (php and composer),
but referenced php via the bare `path:{{ .Virtenv }}/flake` (the flake's
`default` output) while composer used an explicit `#composer` fragment.
Devbox's own flake example documents that flakes exporting more than one
package must be referenced with explicit url fragments
(e.g. `path:.../flake#pkg`); the bare `default` reference is intended for
single-output flakes. Relying on the bare default for one of two outputs is
fragile and has been reported to result in the `php` binary not being linked
into the environment (only `composer` appears).
Add a named `php` output to the plugin flake (keeping `default` for
backwards compatibility) and reference it explicitly as
`path:.../flake#php`, mirroring the working `#composer` entry. Bump the
plugin version so cached create_files are regenerated.
Fixes #2788
There was a problem hiding this comment.
Pull request overview
This PR fixes inconsistent flake output referencing in the PHP plugin by ensuring both php and composer are referenced via explicit flake URL fragments, aligning the plugin with Devbox’s documented multi-output flake guidance and addressing issue #2788 (missing php binary in the environment).
Changes:
- Add a named
phppackage output to the generatedplugins/php/flake.nixwhile keepingdefaultfor backwards compatibility. - Update the plugin package list to reference
phpexplicitly viapath:{{ .Virtenv }}/flake#php. - Bump the PHP plugin version to force regeneration of cached
create_filescontent.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| plugins/php/flake.nix | Exports an explicit php output alongside default and composer to support fragment-based referencing. |
| plugins/php.json | Updates package references to use #php and bumps plugin version to invalidate cached rendered files. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thank you for looking into this! |
|
@claude please review |
|
Claude finished @mikeland73's task in 1m 16s —— View job Review
Diff reviewed: SummaryThis is a correct, minimal fix. The root cause analysis holds up:
Minor, non-blocking observations
Overall: LGTM. The fix aligns the |
Summary
Fixes #2788.
The php plugin's generated flake (
plugins/php/flake.nix) exports twopackages:
but the plugin (
plugins/php.json) referenced them inconsistently — php via thebare
path:{{ .Virtenv }}/flake(i.e. the flake'sdefaultoutput) andcomposer via an explicit
#composerfragment:Root cause
Devbox's own flake example documents that a flake exporting more than one
package must be referenced with explicit url fragments, and that the bare
defaultreference is meant for single-output flakes:Relying on the bare
defaultfor one of two outputs is fragile. In #2788 thissurfaced as the
phpbinary not being linked into the environment (onlycomposerappeared under.devbox/nix/profile/default/bin), leavingphpunavailable in the shell.
Fix
plugins/php/flake.nix: add a namedphpoutput alongside the existingoutputs.
default = phpis kept for backwards compatibility with anyonereferencing the flake directly.
plugins/php.json: reference php explicitly aspath:{{ .Virtenv }}/flake#php, mirroring the working#composerentry, soboth plugin packages are resolved the same way. Bump the plugin version
(
0.0.3→0.0.4) so cachedcreate_filesare regenerated for existingprojects.
This aligns the php plugin with the documented best practice for multi-output
flakes and with the working
examples/flakes/phpexample, which alreadyreferences its php output as
path:my-php-flake#php.How was it tested?
go build ./...— clean.go test ./internal/plugin/... ./internal/shellgen/... ./internal/devconfig/configfile/...— pass.matcher in
flake.nixis unaffected (the new#php/#composerrefs do notmatch the
^php.*Extensions…pattern, same as before).Note: the existing
testscripts/languages/php.test.txt(which runsdevbox run php) exercises both the cached and non-cached php paths and passes onmain,so the failure in #2788 appears to be environment-specific (the reporter was on
devbox 0.16/0.17 with Lix). This change removes the fragile bare-
defaultreliance that is the most likely cause, and makes the plugin consistent with
devbox's documented multi-output flake usage.
cc @assyrus-favolo (issue reporter) — thanks for the detailed reproduction and
the generated
flake.nixin the issue comments, which pinpointed that only thecomposeroutput was making it into the environment.Community Contribution License
All community contributions in this pull request are licensed to the project
maintainers under the terms of the
Apache 2 License.
By creating this pull request, I represent that I have the right to license the
contributions to the project maintainers under the Apache 2 License as stated in
the
Community Contribution License.
🤖 Generated with Claude Code
https://claude.ai/code/session_011G5YZ3hdoiBSd3T9GGLYox
Generated by Claude Code