Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add io.js #6234

Merged
merged 3 commits into from
Feb 22, 2015
Merged

Add io.js #6234

merged 3 commits into from
Feb 22, 2015

Conversation

valeriangalliat
Copy link
Contributor

https://iojs.org/

I copied a bit nodejs/default.nix to make the io.js derivation, though It's my first "real" package and I don't know how to handle eventual shared dependencies, and I removed Darwin specific stuff since I have no Mac to try it.

I successfully built io.js both stable and nightly with this derivation on NixOS.

Also since io.js is Node.js compatible, there's maybe more to do, for example allow to build npm packages with io.js instead of Node.js (not sure this is possible actually, maybe something like nodePackages.override { nodejs = iojs } could work?).

@lucabrunox
Copy link
Contributor

Yes, it should suffice to just do the override in nodePackages. Don't create another set of packages. You can however add a iojsPackages = nodePackages.override { nodejs = iojs; } in all-packages.nix, or something like that.
I'm not even sure that makes sense, what's nodejs used for at build time?

@valeriangalliat
Copy link
Contributor Author

It matters whether Node.js or io.js is used at build time, since the "binaries" will either have a Node.js or io.js shebang depending on what they were built with. One might want to use io.js in place of Node.js for all packages, and thus not depend on Node.js anywhere.

I had to apply a fix in build-node-package.nix since after Node.js source extraction, it was doing a mv *node* $dest, and io.js don't contains node in its archive name, so instead I search for the (assumed only) directory in CWD. It worked fine for me while building Node packages with io.js.

Also I realized I could build io.js without which dependency nor the Node.js setupHook, so I removed them.

@valeriangalliat valeriangalliat changed the title [WIP] [help wanted] Add io.js Add io.js Feb 10, 2015
@lucabrunox
Copy link
Contributor

The node setupHook is for setting NODE_PATH, how would you deal with it otherwise with io.js?

@valeriangalliat
Copy link
Contributor Author

Well, I just think NODE_PATH is not needed to build io.js. I could build io.js successfully without the setupHook, and also install (and run) iojsPackages.mocha.

Also there's no lib/node_modules directory in the io.js archive (nor in Node.js current archive), though I'm not sure tu really understand setupHooks. :/

@lucabrunox
Copy link
Contributor

The NODE_PATH is used when you use libraries. E.g. buildInputs = [ iojs lib1 lib2 ]; then lib1 and lib2 are automatically added to NODE_PATH.

@valeriangalliat
Copy link
Contributor Author

Oh okay, I get it. I just added it back, thanks for the explanation.

@lucabrunox
Copy link
Contributor

Of course, as long as io.js also uses NODE_PATH :P

@valeriangalliat
Copy link
Contributor Author

Yup io.js still uses NODE_PATH.

Looks like there's a strange error during the Travis build:

trying http://registry.npmjs.org/hosted-git-info/-/hosted-git-info-1.5.3.tgz
curl: (22) The requested URL returned error: 400 Bad Request
error: cannot download hosted-git-info-1.5.3.tgz from any mirror
cannot build derivation ‘/nix/store/4vljw7w6xhbysl4h2ns4ny4zx91zcf4x-node-hosted-git-info-1.5.3.drv’: 1 dependencies couldn't be built
cannot build derivation ‘/nix/store/i1i35q3r27vj9j8v1dwi9wiraw52zg6f-node-hosted-git-info-1.5.3.drv’: 1 dependencies couldn't be built
cannot build derivation ‘/nix/store/6ip4g5gfcj5gsqyndm3h4z0x6qan0pkg-node-npm-package-arg-3.0.0.drv’: 1 dependencies couldn't be built
cannot build derivation ‘/nix/store/78pz9zxrmv1prbhfhni24ssgwhyw72c7-node-npm-package-arg-3.0.0.drv’: 1 dependencies couldn't be built
cannot build derivation ‘/nix/store/1b8j22fmn7h37hrh54l01509m34wjh5r-node-npm-registry-client-6.0.3.drv’: 1 dependencies couldn't be built
cannot build derivation ‘/nix/store/dnllnjwvvsj5m8v5fpjpfq8lm349qrfs-node-npm-registry-client-6.0.3.drv’: 1 dependencies couldn't be built
cannot build derivation ‘/nix/store/bq8lx0r49rb0dz34r631984akp89ybsn-bin-npm-2.4.1.drv’: 1 dependencies couldn't be built

I'll dig this tonight, but at first sight I don't get why io.js would make a Bad Request to npm URL.

@valeriangalliat
Copy link
Contributor Author

If the previous error was about iojsPackages.npm failing to be built, it works well on my side… nix-build ~/nixpkgs -A iojsPackages.npm completes successfully and I have a properly working npm result, interpreted against io.js binary.


BTW I see that nix-env -i iojs takes the nightly version, like nix-env -i nodejs takes the unstable version by default… is it desired? Technically, I guess this is because unstable/nightly is declared after the stable package in all-packages.nix, and have the same derivation name, right?

@lucabrunox
Copy link
Contributor

Yes if derivation names are ambiguous of course nix-env just chooses one.

@lucabrunox
Copy link
Contributor

When you update pull requests, please comment. We don't get notified otherwise.

@valeriangalliat
Copy link
Contributor Author

I just rebased on master because nox-review pr was not able to merge the PR, but I didn't changed the actual Nix expression for io.js. :)

Anyway, nox-review pr is failing on my side; it fails during the compilation of the buffertools Node module, when compiling Release/obj.target/buffertools/buffertools.o, with numerous compilation errors (can reproduce with nix-build -A iojsPackages.stream-splitter-transform and nix-build -A nodePackages.stream-splitter-transform which depends on some version of buffertools, but the direct nodePackages.buffertools and iojsPackages.buffertools works.

On Travis side, it seems to have killed the process because it was taking too much time (or log size too big, that's the only "error" I see).

@lucabrunox
Copy link
Contributor

I've noticed that iojs compiles a lot of stuff statically. Let's use the existing libraries present in nixpkgs instead:

diff --git a/pkgs/development/web/iojs/default.nix b/pkgs/development/web/iojs/default.nix
index 58368ac..3129b10 100644
--- a/pkgs/development/web/iojs/default.nix
+++ b/pkgs/development/web/iojs/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, python, utillinux, nightly ? false }:
+{ stdenv, fetchurl, python, utillinux, openssl, http-parser, zlib, nightly ? false }:

 let
   version = if nightly then "1.2.1-nightly20150213f0296933f8" else "1.2.0";
@@ -19,7 +19,9 @@ in stdenv.mkDerivation {
     sed -e 's|^#!/usr/bin/env python$|#!${python}/bin/python|g' -i configure
   '';

-  buildInputs = [ python ] ++ (optional stdenv.isLinux utillinux);
+  configureFlags = [ "--shared-openssl" "--shared-http-parser" "--shared-zlib" ];
+
+  buildInputs = [ python openssl http-parser zlib ] ++ (optional stdenv.isLinux utillinux);
   setupHook = ../nodejs/setup-hook.sh;

   meta = {

Still missing libuv which is not packaged, and v8 because it's still at version 3 while I think iojs requires version 4. I believe nodejs has the same problem, but well let's start fixing this in iojs.

As for stream-splitter-transforms, also nodePackages fails so I don't see the problem. Note that nodePackages.buffertools is version 2.1.2, while stream-splitter-transforms requires buffertools 1.1.1 which is the one failing.

So once you apply the above diff (if you agree), I'm going to merge this.

@valeriangalliat
Copy link
Contributor Author

Thank you for the shared libraries, I was not sure how to do that (but I see Nix make this really simple in the end, awesome)!

@valeriangalliat
Copy link
Contributor Author

BTW libuv seems to be packaged already, but io.js uses libuv 1.4.0 which is not in nixpkgs yet.

lucabrunox pushed a commit that referenced this pull request Feb 22, 2015
@lucabrunox lucabrunox merged commit fb41f03 into NixOS:master Feb 22, 2015
@lucabrunox
Copy link
Contributor

Ok let's merge and see what happens. Thanks. Will revert in case it breaks much stuff and reiterate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants