nix-community / npmlock2nix

nixify npm based packages [maintainer=@andir]
Apache License 2.0
130 stars 42 forks source link

Allow patching dependency sources #151

Closed infinisil closed 2 years ago

infinisil commented 2 years ago

Adds support for patching dependency sources with patches and postPatch derivation attributes. This is a bit hacky, as patching any files requires recalculating the integrity value, which needs to be done at build-time. But it works, and I made sure to make the code resilient and commented.

This is a solution for https://github.com/nix-community/npmlock2nix/issues/110, as this allows doing patchShebangs on individual packages. npmlock2nix could also provide a predefined list of patches for individual packages for convenience in the future.

nixos-discourse commented 2 years ago

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/tweag-nix-dev-update-26/18252/1

andir commented 2 years ago

Thank you for the updates you provided. I'll try to get through them some afternoon this week.

andir commented 2 years ago

Besides the override interface this looks fine and I'd accept it. @infinisil can you make that change?

infinisil commented 2 years ago

@andir Changed the interface according to your suggestion.

While I think there's some redundancy to it (because it's probably always going to be a .overrideAttrs, and the old argument isn't really needed), I think the benefit of familiarity is beneficial enough. Also the implementation becomes a bit nicer.

infinisil commented 2 years ago

(ping, does this look good?)