nix-community / yarn2nix

Generate nix expressions from a yarn.lock file [maintainer=???]
GNU General Public License v3.0
123 stars 61 forks source link

Python project with yarn-based frontend #104

Open uvNikita opened 5 years ago

uvNikita commented 5 years ago

I'm not sure if it's in the scope of this project, but maybe you have some advice on how I should approach this.

We have a web project that has a python backend and javascript frontend which I'm trying to migrate over to nix. The project structure looks approximately like this (note that we have several yarn workspaces defined):

project
├── backend
│   ├── __init__.py
│   ├── ...
├── frontend
│   ├── babel.config.js
│   ├── package.json
│   ├── w1
│   │   └── package.json
│   ├── w2
│   │   └── package.json
│   └── yarn.lock
├── requirements-dev.txt
├── requirements-test.txt
└── requirements.txt

The end goal is to build a resulting package using nix (it should contain both python code and minified js files) as well as to have a development environment where we could start a frontend and backend development servers. So, ideally, running nix build should produce a package and running nix-shell should give a shell where node_modules are available together with all python dependencies.

So my question is if there is, are there any best practices about how to combine two ways to build packages: yarn2nix and something like buildPythonPackage, pip2nix, or setup.nix?

Will appreciate any input on this.