fix(php plugin): reference php output via explicit flake fragment#2900
Open
mikeland73 wants to merge 1 commit into
Open
fix(php plugin): reference php output via explicit flake fragment#2900mikeland73 wants to merge 1 commit into
mikeland73 wants to merge 1 commit into
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
Contributor
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! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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