svanderburg / composer2nix

Generate Nix expressions to build PHP composer packages
MIT License
88 stars 25 forks source link

Respect composer.json "target-dir" when linking dependencies #2

Closed Nadrieril closed 7 years ago

Nadrieril commented 7 years ago

This fixes https://github.com/svanderburg/composer2nix/issues/1. This is a bit quick & dirty but does the job. It adds jq as a dependency but it is quite light. You could certainly write a php script for that instead if you don't like this dependency.

svanderburg commented 7 years ago

I just wrote my own solution to cope with the target-dir property.

Although your solutions works, it has two disadvantages: introducing jq means introducing yet another build-time dependency which is not needed IMHO. PHP itself can also parse JSON files.

Second, you parse each composer.json file of each dependency, while the composer.lock file of the enclosing project contains all the information you need including the properties it needs to know of the dependencies.

I just committed a change and tested it with a very simple example. Can you check whether it works for you?

Nadrieril commented 7 years ago

I tried to test your latest commit but composer tried to install some of the dependencies after they should all have been linked. So I don't know if the problem is fixed or if there is something else. I'm sorry but I will not try to investigate this, since I've found a pre-built tar.gz for the package I needed to build and I don't need composer2nix anymore. Thanks for your work though, I'm sure this will help other people :)