Skip to content

Native packages on nodePackages for nixpkgs #71

@CMCDragonkai

Description

@CMCDragonkai

I'm trying to follow the instructions for https://github.com/NixOS/nixpkgs/tree/master/pkgs/development/node-packages

But there's nothing talking about how to deal with npm packages that require the usage of node-gyp.

Specifically I'm trying to add dat to Nixpkgs.

So I added dat to the node-packages-v4.json. Ran the generate.sh.

Then after I tried a nix-build -A nodePackages_6_x.dat. It eventually resulted in this error:

> node-gyp-build "node preinstall.js" "node postinstall.js"

sh: node-gyp-build: command not found

npm ERR! Linux 4.9.57
npm ERR! argv "/nix/store/hxh3ii14s2982w5qm257wr2ms2df1jmj-nodejs-6.11.5/bin/node" "/nix/store/hxh3ii14s2982w5qm257wr2ms2df1jmj-nodejs-6.11.5/bin/npm" "--registry" "http://www.example.com" "--nodedir=/nix/store/1m3xr12sc9d5ckdy7znnszs52vdy3jxz-node-sources" "--production" "rebuild"
npm ERR! node v6.11.5
npm ERR! npm  v3.10.10
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] install: `node-gyp-build "node preinstall.js" "node postinstall.js"`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node-gyp-build "node preinstall.js" "node postinstall.js"'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the sodium-native package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp-build "node preinstall.js" "node postinstall.js"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs sodium-native
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls sodium-native
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /nix/store/a207hmhxr9nsjhs408rjljy7dvynmp1c-node-dat-13.9.2/lib/node_modules/dat/npm-debug.log
builder for ‘/nix/store/5gj9zw4hhwzanycak7g9wd2h2pyrcbaj-node-dat-13.9.2.drv’ failed with exit code 1
error: build of ‘/nix/store/5gj9zw4hhwzanycak7g9wd2h2pyrcbaj-node-dat-13.9.2.drv’ failed

I can use node-gyp normally in my shell.nix (when I'm developing with packages that require this), but how do I get this working for node2nix in Nixpkgs?

I do something like this:

{
   pkgs ? import (fetchTarball https://github.com/NixOS/nixpkgs-chan
 }:
   with pkgs;
   stdenv.mkDerivation {
     name = "js-virtualgit";
     buildInputs = [ nodejs-8_x nodePackages_6_x.node-gyp blas flow 
   }

When doing the above, npm install dat works perfectly.

Is there some override that has to be set?

Also I found that since I'm running on the older node2nix, the 1.3.0, it overwrote a bunch of changes you made to the nodePackages directory recently. Shouldn't the generate.sh fix the hash of node2nix that you want us to use for PRing new node packages?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions