Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions discovery_others.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ package phpstore

import (
"bytes"
"os"
"os/exec"
"path/filepath"
"regexp"
Expand Down Expand Up @@ -66,6 +67,20 @@ func (s *PHPStore) doDiscover() {
s.discoverFromDir(prefix, nil, regexp.MustCompile(`^php/(?:[\d\._]+)$`), "homebrew")
}

// Nix (https://nixos.org/): PHP built with its extensions is stored as
// /nix/store/<hash>-php-with-extensions-<version>. Because /nix/store can
// hold thousands of unrelated packages, glob the matching entries directly
// instead of walking the whole tree.
if dirs, err := filepath.Glob("/nix/store/*-php-with-extensions-*"); err == nil {
for _, dir := range dirs {
// skip .drv files and any other non-directory matches
if fi, err := os.Stat(dir); err != nil || !fi.IsDir() {
continue
}
s.addFromDir(dir, nil, "Nix")
}
}

if runtime.GOOS == "darwin" {
// Liip PHP https://php-osx.liip.ch/ (pattern example: php5-7.2.0RC1-20170907-205032/bin/php)
s.discoverFromDir("/usr/local", nil, regexp.MustCompile(`^php5\-[\d\.]+(?:RC|BETA)?\d*\-\d+\-\d+$`), "Liip PHP")
Expand Down
Loading