Skip to content

Commit c2bfcc1

Browse files
committed
Try to detect NixOS installation of composer, fix #123
1 parent 410b6e6 commit c2bfcc1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

local/php/composer.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,19 @@ func composerVersion() int {
132132
}
133133

134134
func findComposer(extraBin string) (string, error) {
135+
// Special Support for NixOS. It needs to run before the PATH detection
136+
// because NixOS adds a shell wrapper that we can't run via PHP.
137+
for _, path := range strings.Split(os.Getenv("buildInputs"), " ") {
138+
nixPharPath := filepath.Join(path, "libexec/composer/composer.phar")
139+
d, err := os.Stat(nixPharPath)
140+
if err != nil {
141+
continue
142+
}
143+
if m := d.Mode(); !m.IsDir() {
144+
// Yep!
145+
return nixPharPath, nil
146+
}
147+
}
135148
for _, file := range []string{extraBin, "composer", "composer.phar"} {
136149
if pharPath, _ := LookPath(file); pharPath != "" {
137150
// On Windows, we don't want the .bat, but the real composer phar/PHP file

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy