···68686969each tool has an abstraction to just build the node_modules (dependencies) directory. you can always use the stdenv.mkDerivation with the node_modules to build the package (symlink the node_modules directory and then use the package build command). the node_modules abstraction can be also used to build some web framework frontends. For an example of this see how [plausible](https://github.com/NixOS/nixpkgs/blob/master/pkgs/servers/web-apps/plausible/default.nix) is built. mkYarnModules to make the derivation containing node_modules. Then when building the frontend you can just symlink the node_modules directory
70707171+## javascript packages inside nixpkgs {#javascript-packages-nixpkgs}
7272+7373+The `pkgs/development/node-packages` folder contains a generated collection of
7474+[NPM packages](https://npmjs.com/) that can be installed with the Nix package
7575+manager.
7676+7777+As a rule of thumb, the package set should only provide _end user_ software
7878+packages, such as command-line utilities. Libraries should only be added to the
7979+package set if there is a non-NPM package that requires it.
8080+8181+When it is desired to use NPM libraries in a development project, use the
8282+`node2nix` generator directly on the `package.json` configuration file of the
8383+project.
8484+8585+The package set provides support for the official stable Node.js versions.
8686+The latest stable LTS release in `nodePackages`, as well as the latest stable
8787+Current release in `nodePackages_latest`.
8888+8989+If your package uses native addons, you need to examine what kind of native
9090+build system it uses. Here are some examples:
9191+9292+- `node-gyp`
9393+- `node-gyp-builder`
9494+- `node-pre-gyp`
9595+9696+After you have identified the correct system, you need to override your package
9797+expression while adding in build system as a build input. For example, `dat`
9898+requires `node-gyp-build`, so [we override](https://github.com/NixOS/nixpkgs/blob/32f5e5da4a1b3f0595527f5195ac3a91451e9b56/pkgs/development/node-packages/default.nix#L37-L40) its expression in [`default.nix`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/node-packages/default.nix):
9999+100100+```nix
101101+ dat = super.dat.override {
102102+ buildInputs = [ self.node-gyp-build pkgs.libtool pkgs.autoconf pkgs.automake ];
103103+ meta.broken = since "12";
104104+ };
105105+```
106106+107107+To add a package from NPM to nixpkgs:
108108+109109+1. Modify `pkgs/development/node-packages/node-packages.json` to add, update
110110+ or remove package entries to have it included in `nodePackages` and
111111+ `nodePackages_latest`.
112112+2. Run the script: `cd pkgs/development/node-packages && ./generate.sh`.
113113+3. Build your new package to test your changes:
114114+ `cd /path/to/nixpkgs && nix-build -A nodePackages.<new-or-updated-package>`.
115115+ To build against the latest stable Current Node.js version (e.g. 14.x):
116116+ `nix-build -A nodePackages_latest.<new-or-updated-package>`
117117+4. Add and commit all modified and generated files.
118118+119119+For more information about the generation process, consult the
120120+[README.md](https://github.com/svanderburg/node2nix) file of the `node2nix`
121121+tool.
122122+71123## Tool specific instructions {#javascript-tool-specific}
7212473125### node2nix {#javascript-node2nix}
-51
doc/languages-frameworks/node.section.md
···11-# Node.js {#node.js}
22-33-The `pkgs/development/node-packages` folder contains a generated collection of
44-[NPM packages](https://npmjs.com/) that can be installed with the Nix package
55-manager.
66-77-As a rule of thumb, the package set should only provide *end user* software
88-packages, such as command-line utilities. Libraries should only be added to the
99-package set if there is a non-NPM package that requires it.
1010-1111-When it is desired to use NPM libraries in a development project, use the
1212-`node2nix` generator directly on the `package.json` configuration file of the
1313-project.
1414-1515-The package set provides support for the official stable Node.js versions.
1616-The latest stable LTS release in `nodePackages`, as well as the latest stable
1717-Current release in `nodePackages_latest`.
1818-1919-If your package uses native addons, you need to examine what kind of native
2020-build system it uses. Here are some examples:
2121-2222-* `node-gyp`
2323-* `node-gyp-builder`
2424-* `node-pre-gyp`
2525-2626-After you have identified the correct system, you need to override your package
2727-expression while adding in build system as a build input. For example, `dat`
2828-requires `node-gyp-build`, so [we override](https://github.com/NixOS/nixpkgs/blob/32f5e5da4a1b3f0595527f5195ac3a91451e9b56/pkgs/development/node-packages/default.nix#L37-L40) its expression in [`default.nix`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/node-packages/default.nix):
2929-3030-```nix
3131- dat = super.dat.override {
3232- buildInputs = [ self.node-gyp-build pkgs.libtool pkgs.autoconf pkgs.automake ];
3333- meta.broken = since "12";
3434- };
3535-```
3636-3737-To add a package from NPM to nixpkgs:
3838-3939- 1. Modify `pkgs/development/node-packages/node-packages.json` to add, update
4040- or remove package entries to have it included in `nodePackages` and
4141- `nodePackages_latest`.
4242- 2. Run the script: `cd pkgs/development/node-packages && ./generate.sh`.
4343- 3. Build your new package to test your changes:
4444- `cd /path/to/nixpkgs && nix-build -A nodePackages.<new-or-updated-package>`.
4545- To build against the latest stable Current Node.js version (e.g. 14.x):
4646- `nix-build -A nodePackages_latest.<new-or-updated-package>`
4747- 4. Add and commit all modified and generated files.
4848-4949-For more information about the generation process, consult the
5050-[README.md](https://github.com/svanderburg/node2nix) file of the `node2nix`
5151-tool.
+1-1
pkgs/development/node-packages/README.md
···11-Moved to [/doc/languages-frameworks/node.section.md](/doc/languages-frameworks/node.section.md)
11+Moved to [/doc/languages-frameworks/javascript.section.md](/doc/languages-frameworks/javascript.section.md)