svanderburg / composer2nix

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

implement packageOverrides argument #24

Open charlieshanley opened 3 years ago

charlieshanley commented 3 years ago

This makes it so the generated nix expressions accept the argument packageOverrides, which allows users to override the derivations of dependencies. This is desirable in the case that a dependency cannot be built with nix as-is -- my motivating case was a package that wanted to make network requests in post-install-cmd.

packageOverrides should be an attrset whose values are a function from the old derivation to a new one.

Here is an example:

packageOverrides = {
  "podlibre/ipcat" = oldPkg: applyPatches {
    src = oldPkg;
    patches = [(substituteAll {
      src = ./datacenters.patch;
      datacenters = "${ipcat}/datacenters.csv";
    })];
  };
};
svanderburg commented 2 years ago

Hi, I'm afraid due to my earlier changes this pull request is conflicting.

I think the overriding feature can be quite useful. Would it be possible for you to rebase your changes?

Furthermore, can you also write a small example that can be added to the README.md? Otherwise, it's a hidden feature and there's a chance this will bit rot because it can't be properly tested and maintained.