I've started using node2nix with native addon projects where I'm compiling from C/C++ source in MatrixAI/TypeScript-Demo-Lib#38.
I noticed that inside node-env.nix, it's doing:
# Extract the Node.js source code which is used to compile packages with
# native bindings
nodeSources = runCommand "node-sources" {} ''
tar --no-same-owner --no-same-permissions -xf ${nodejs.src}
mv node-* $out
'';
|
# Extract the Node.js source code which is used to compile packages with |
|
# native bindings |
|
nodeSources = runCommand "node-sources" {} '' |
|
tar --no-same-owner --no-same-permissions -xf ${nodejs.src} |
|
mv node-* $out |
|
''; |
Which is later used in --nodedir options for npm rebuild and npm install.
I've found that just using nodejs is a better option than nodejs.src.
Firstly because you don't need to extract from any tar archive, and secondly because nodejs actually contains all the relevant configuration. Right now nodejs.src doesn't have the config.gypi file that does in fact exist in the nodejs store path.
This warning message is shown when using node-gyp against nodejs.src while the warning message doesn't show when just using nodejs store output.
gyp WARN read config.gypi ENOENT: no such file or directory, open '/nix/store/9av58jhvx76lqysgrzc0kixg9f210r2x-node-sources/include/node/config.gypi'
I think it can be entirely removed, and replaced with just --nodedir=${nodejs}.
I've started using node2nix with native addon projects where I'm compiling from C/C++ source in MatrixAI/TypeScript-Demo-Lib#38.
I noticed that inside
node-env.nix, it's doing:node2nix/nix/node-env.nix
Lines 204 to 209 in 68f5735
Which is later used in
--nodediroptions fornpm rebuildandnpm install.I've found that just using
nodejsis a better option thannodejs.src.Firstly because you don't need to extract from any tar archive, and secondly because
nodejsactually contains all the relevant configuration. Right nownodejs.srcdoesn't have theconfig.gypifile that does in fact exist in thenodejsstore path.This warning message is shown when using
node-gypagainstnodejs.srcwhile the warning message doesn't show when just usingnodejsstore output.I think it can be entirely removed, and replaced with just
--nodedir=${nodejs}.