[Nix-dev] npm prepublish hook

Shea Levy shea at shealevy.com
Tue Dec 10 15:01:25 CET 2013


Hi Mathijs (nix-dev cc'd),

Thanks for pointing this out! This does seem very stupid, but isaacs 
seems committed to the change so we'll have to live with it. 
Unfortunately some packages will *depend* on the new behavior now, so I 
think the best case is maintaining a manual list, as unfortunate as that 
sounds. Hopefully this will be fixed soon in most packages.

For packages that are installed from a tarball (which is most), issues 
with read-only paths shouldn't come up. If there's a common set of 
utilities always expected in $PATH we may as well resign ourselves to 
adding those to buildInputs unconditionally.

Any idea of a better way to do this?

Thanks,
Shea

On 12/10/2013 08:24 AM, Mathijs Kwik wrote:
> Hi Shea,
>
> I noticed a few npms that started running tests during their installation.
> For example "bytebuffer" and "protobufjs".
> It turns out npm decided to run prepublish hooks on install now.
> https://github.com/isaacs/npm/issues/3059
> There is some discussion about it because it sounds like a stupid idea
> (or a stupid hook name), but nixos is bitten by this more than others.
> The prepublish hook for many packages runs tests, and tests expect the
> source dir to be writable or certain things to be available in the
> path.
> I would not expect all packages to better themselves in the short term.
>
> The easiest "fix" is to either remove tests or prepublish from
> package.json as an additional patch in patchSource. However, I think
> we should not hack packages that just work. And because most packages
> get generated, we should keep some "noTests" list externally same as
> with nativeDeps. But that all becomes quite messy and fragile imo.
>
> What do you think?
>
> Regards,
> Mathijs



More information about the nix-dev mailing list