svanderburg / node2nix

Generate Nix expressions to build NPM packages
MIT License
520 stars 99 forks source link

Use cleanSource and/or cleanSourceWith to avoid cruft #214

Open lionello opened 3 years ago

lionello commented 3 years ago

I find myself always editing the generated node-packages.nix and changing the last src = ./.; into:

    src = lib.cleanSourceWith { filter = name: type: (builtins.baseNameOf name) != "node_modules"; src = lib.cleanSource ./.; };

This would also take care of "WARNING: There is a node_modules/ folder in the root directory of the project!"

(That expression uses lib, which would get passed in from the composition Nix file)

svanderburg commented 3 years ago

Indeed, in most cases you typically don't want to pollute your deployments with the node_modules/ folder of the project, but sometimes this can be handy -- for example, for experimentation, or when you want to work on a project that ships bundled dependencies.

roberth commented 2 years ago

Perhaps this could be made easier to overriding, or perhaps overriding it could be documented prominently somewhere.