stephank / yarn-plugin-nixify

Yarn v3/v4 plugin to help with Nix packaging
BSD 2-Clause "Simplified" License
68 stars 7 forks source link

Multiple packages in monorepo #63

Open niklaskorz opened 1 year ago

niklaskorz commented 1 year ago

Maybe I just misunderstand how to use the resulting yarn-project.nix, but from what I see it only generates a single derivation for the root package.json, instead of one derivation per package/workspace in the monorepo. Ideally, a derivation should be generated for every package of a monorepo like dream2nix does for npm 8+ workspaces so they can be cached separately.

stephank commented 1 year ago

I currently have 2 projects with workspaces packaged using this plugin, but I guess I've not had the need for this because they only have one final runnable package. I've used it mostly to split off webpack builds and shared client/server libraries.

I don't really have a good idea what separate derivations would look like. Do you want to build each part of the workspace starting from a packaged version (yarn pack)? But then in practice, yarn pack is often preceded by build steps, which may need access to the entire workspace and dev dependencies, and we have to capture these in Nix code somehow.

nekowinston commented 1 year ago

yarn workspaces focus in yarn v4 might be a way to let yarn resolve which packages are needed for which workspace members, if I understand the feature correctly.

Thanks for creating & maintaining this plugin. ❤️