nijs icon indicating copy to clipboard operation
nijs copied to clipboard

install nijs using only npm

Open dckc opened this issue 9 years ago • 6 comments

I started a fresh docker container, cloned this project, and ran the nijs-build pkgs.js -A hello example, and blammo:

$ docker run -ti node bash
root@13faaf1261d9:/# npm install -f nijs

root@13faaf1261d9:/# git clone https://github.com/svanderburg/nijs.git
root@13faaf1261d9:/# cd nijs/
root@13faaf1261d9:/nijs# cd tests/


root@13faaf1261d9:/nijs/tests# nijs-build pkgs.js -A hello
/usr/local/lib/node_modules/nijs/lib/generate.js:38
    var matchedIdentifier = attrName.match(/[a-zA-Z\_][a-zA-Z0-9\_\'\-]*/);
                                     ^

RangeError: Maximum call stack size exceeded
    at RegExp.exec (native)
    at RegExp.[Symbol.match] (native)
    at String.match (native)
    at objectKeyToAttrName (/usr/local/lib/node_modules/nijs/lib/generate.js:38:38)
    at objectMembersToAttrsMembers (/usr/local/lib/node_modules/nijs/lib/generate.js:101:27)
    at jsToIndentedNix (/usr/local/lib/node_modules/nijs/lib/generate.js:198:37)
    at objectMembersToAttrsMembers (/usr/local/lib/node_modules/nijs/lib/generate.js:104:52)
    at jsToIndentedNix (/usr/local/lib/node_modules/nijs/lib/generate.js:198:37)
    at jsToIndentedNix (/usr/local/lib/node_modules/nijs/lib/generate.js:171:54)
    at objectMembersToAttrsMembers (/usr/local/lib/node_modules/nijs/lib/generate.js:104:52)

root@13faaf1261d9:/nijs/tests# git log -n1
commit 2003ee7fa9d032e7803664414506224b86d16a9d
Author: Sander van der Burg <[email protected]>
Date:   Wed Jun 22 18:09:30 2016 +0000

    Use a custom set of packages for underscore

dckc avatar Oct 29 '16 19:10 dckc

Hmm weird. I must admit that I haven't tried docker, but when I install nijs with the release.nix expression, via Nixpkgs, or directly with npm on my local machine, it just seems to work fine for me.

svanderburg avatar Oct 30 '16 14:10 svanderburg

I think docker is less relevant than installing nijs from npm vs from git sources and nix-env.

I just tested installing the current git version 2003ee7fa9d032e7803664414506224b86d16a9d with nix-env -f release.nix -iA nodePackages.nijs outside docker, in this Ubuntu 16.04 machine, and that works fine.

I just tried using the git sources and nix-env within the docker image (which is based on alpine, btw) and lost in a different way:

bash-4.3# apk update
bash-4.3# apk add git curl
bash-4.3# curl https://nixos.org/nix/install | sh

bash-4.3# nix-channel --add https://nixos.org/channels/nixpkgs-unstable
bash-4.3# nix-channel --update
downloading Nix expressions from ‘https://d3g5gsiof5omrk.cloudfront.net/nixpkgs/nixpkgs-17.03pre94694.fa4167c/nixexprs.tar.xz’...
downloading ‘https://d3g5gsiof5omrk.cloudfront.net/nixpkgs/nixpkgs-17.03pre94694.fa4167c/nixexprs.tar.xz’... [0/0 KiB, 0.0 KiB/s]
unpacking channels...
created 2 symlinks in user environment

bash-4.3# git clone https://github.com/svanderburg/nijs.git
bash-4.3# cd nijs/
bash-4.3# nix-env -f release.nix -iA nodePackages.nijs
error: attribute ‘nodePackages’ in selection path ‘nodePackages.nijs’ not found

dckc avatar Oct 30 '16 20:10 dckc

@dckc To install nijs from the release expression included in this repo, use:

$ nix-env -f release.nix -iA package.x86_64-linux

svanderburg avatar Oct 31 '16 09:10 svanderburg

Ah right... well, I lose doing that too (details below).

I think I'm getting lost in a maze of twisty docker containers. And that's really beside the point. I should revise the issue to show my real goal...

$ docker run --rm -ti nixos/nix bash

bash-4.3# git clone https://github.com/svanderburg/nijs.git
bash-4.3# cd nijs
bash-4.3# nix-env -f release.nix -iA package.x86_64-linux

bash-4.3# cd tests
bash-4.3# nijs-build pkgs.js -A hello
these derivations will be built:
  /nix/store/xgc32zdncq9irba6dpjlds74xc2xd07i-hello-2.9.tar.gz.drv
  /nix/store/kgsfjpn4k0wqj3v2050q1fg70gi6rzvx-hello-2.9.drv
building path(s) ‘/nix/store/xdilnlzvvsf7r33gs4vy9jq2bmazlc0j-hello-2.9.tar.gz’
/nix/store/ybydv3xnqg1yq8ynazv6s3szfybidppl-builder.sh: line 12: /run/current-system/sw/bin/curl: No such file or directory
/nix/store/ybydv3xnqg1yq8ynazv6s3szfybidppl-builder.sh: line 12: /run/current-system/sw/bin/curl: No such file or directory
/nix/store/ybydv3xnqg1yq8ynazv6s3szfybidppl-builder.sh: line 12: /run/current-system/sw/bin/curl: No such file or directory
/nix/store/ybydv3xnqg1yq8ynazv6s3szfybidppl-builder.sh: line 12: /run/current-system/sw/bin/curl: No such file or directory
/nix/store/ybydv3xnqg1yq8ynazv6s3szfybidppl-builder.sh: line 12: /run/current-system/sw/bin/curl: No such file or directory
/nix/store/ybydv3xnqg1yq8ynazv6s3szfybidppl-builder.sh: line 12: /run/current-system/sw/bin/curl: No such file or directory
/nix/store/ybydv3xnqg1yq8ynazv6s3szfybidppl-builder.sh: line 12: /run/current-system/sw/bin/curl: No such file or directory
/nix/store/ybydv3xnqg1yq8ynazv6s3szfybidppl-builder.sh: line 12: /run/current-system/sw/bin/curl: No such file or directory
builder for ‘/nix/store/xgc32zdncq9irba6dpjlds74xc2xd07i-hello-2.9.tar.gz.drv’ failed with exit code 1
cannot build derivation ‘/nix/store/kgsfjpn4k0wqj3v2050q1fg70gi6rzvx-hello-2.9.drv’: 1 dependencies couldn't be built
error: build of ‘/nix/store/kgsfjpn4k0wqj3v2050q1fg70gi6rzvx-hello-2.9.drv’ failed
nix-build exited with status: 1

dckc avatar Nov 01 '16 01:11 dckc

My real goal is for people to just check out my project and npm install... or perhaps a short list of npm commands.

In particular, I'd like nix to get installed automatically. I suppose that's a pretty tall order, but npm install electron would seem to involve a similar feat. But I don't suppose it needs to write to /.

dckc avatar Nov 01 '16 02:11 dckc

Yep, npm install electron is contained in the project's node_modules, not /.

trusktr avatar Jan 10 '20 01:01 trusktr