NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.67k stars 13.81k forks source link

nodePackages.elm-test: No such file or directory #45280

Closed jasoncarr0 closed 5 years ago

jasoncarr0 commented 6 years ago

Issue description

The elm-test package in nodePackages

Steps to reproduce

Via nixpkgs:

$ nix run nixpkgs.elmPackages.elm nixpkgs.nodePackages.elm-test
$ elm-test init
$ elm-test
Success! Compiled 54 modules.                                       
Successfully generated /dev/null
Unhandled exception while running the tests: { Error: spawn /nix/store/rll733jmgykq2sxrjbjgsm8hy6wzpsv8-node-elm-test-0.18.12/lib/node_modules/elm-test/bin/elm-interface-to-json ENOENT
    at exports._errnoException (util.js:1020:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:197:32)
    at onErrorNT (internal/child_process.js:376:16)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)
  code: 'ENOENT',
  errno: 'ENOENT',
  syscall: 'spawn /nix/store/rll733jmgykq2sxrjbjgsm8hy6wzpsv8-node-elm-test-0.18.12/lib/node_modules/elm-test/bin/elm-interface-to-json',
  path: '/nix/store/rll733jmgykq2sxrjbjgsm8hy6wzpsv8-node-elm-test-0.18.12/lib/node_modules/elm-test/bin/elm-interface-to-json',
  spawnargs: [ '--path', '/home/example/empty/tests' ] }

Similar results follow from npm install.

Technical details

The elm-interface-to-json binary installed via npm does not work with NixOS. After installing via npm install, similar issues arise. The issue was fixed for me by deleting the elm-interface-to-json binary in node_modules/elm-test/bin, and instead linking the copy from the nix store (from elmPackages).

Please run nix-shell -p nix-info --run "nix-info -m" and paste the results.

 - system: `"x86_64-linux"`
 - host os: `Linux 4.14.56, NixOS, 18.03.132915.d6c6c7fcec6 (Impala)`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.0.4`
 - channels(root): `"nixos-18.03.132915.d6c6c7fcec6"`
 - channels(jason): `"bleeding-edge, temp-pijul-0.10, unstable-18.09pre147850.2428f5dda13"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs`

Proposed fix

Move elm-test into elmPackages, build it against existing elm-interface-to-json.

mdevlamynck commented 5 years ago

https://github.com/mdevlamynck/nixpkgs/tree/elm-test This branch contains a package for elmi-to-json and a package for elm-test (for elm 0.19.0). These were generated with cabal2nix and node2nix.

Remaining problems:

domenkozar commented 5 years ago

Try using https://github.com/adisbladis/pnpm2nix for nodejs

stoeffel commented 5 years ago

happy to get rid of rainbow-0.30.0.2. Would totally appreciate a PR ❤️

mdevlamynck commented 5 years ago

I can try to make a PR but I don't know much about haskell or its ecosystem, what would you replace rainbow with?

stoeffel commented 5 years ago

@mdevlamynck I would just remove it completely. It's not really necessary. I might get to it next week, but happy to help you if you have questions. I'm @stoeffel on http://elmlang.slack.com.

mdevlamynck commented 5 years ago

elmi-to-json now builds!

@domenkozar Thanks for your suggestion! I managed to get node-elm-runner building with pnpm2nix. Do you have an example using it within nixpkgs? (nixos noob here).

The issue of patching the path to elmi-to-json remains though. Also I think I might need to also patch the path to elm in node-elm-compiler. Anyway, we're progressing!

dmvianna commented 5 years ago

Any update on this? As it stands, a fairly basic Elm library (its test runner) cannot be used in Nixos. I wasn't able to make it work on OSX either, but it seems that the problem is being pushed down to OSes to fix it. I wonder if anyone have made it run anywhere?

Result of nix-shell -p nodePackages.elm-test

> elm-test@0.18.12 install /nix/store/f37rg7c6zq4zdds87mcahpv7pfz0w88x-node-elm-test-0.18.12/lib/node_modules/elm-test
> node install.js

Error communicating with URL https://dl.bintray.com/elmlang/elm-test/0.18.12/linux-x64.tar.gz Error: getaddrinfo ENOTFOUND dl.bintray.com dl.bintray.com:443
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! elm-test@0.18.12 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the elm-test@0.18.12 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /build/.npm/_logs/2019-03-17T04_30_07_655Z-debug.log
builder for '/nix/store/kchksb44p66q56myw0zr0f3sijn55hwa-node-elm-test-0.18.12.drv' failed with exit code 1
error: build of '/nix/store/kchksb44p66q56myw0zr0f3sijn55hwa-node-elm-test-0.18.12.drv' failed
domenkozar commented 5 years ago

@svanderburg do you have an idea why binwrap-install is missing, given that elmi-to-json depends on binwrap pacakges and tries to execute binary from it?

> elmi-to-json@0.19.1 install /nix/store/rwwndxadj3zmryyla7mafaypvy43kdzj-node-elm-test-0.19.0-rev5/lib/node_modules/elm-test/node_modules/elmi-to-json
> binwrap-install

sh: binwrap-install: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! elmi-to-json@0.19.1 install: `binwrap-install`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the elmi-to-json@0.19.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /build/.npm/_logs/2019-03-18T03_33_36_174Z-debug.log
builder for '/nix/store/awg2k8pvr20dmzsrk1ps6p3sgbj49bwp-node-elm-test-0.19.0-rev5.drv' failed with exit code 1
error: build of '/nix/store/awg2k8pvr20dmzsrk1ps6p3sgbj49bwp-node-elm-test-0.19.0-rev5.drv' failed
turboMaCk commented 5 years ago

This is what I do to fix it for now https://github.com/turboMaCk/nix-elm-tools/blob/master/patch-bin-wrap.nix

basically, I mock binwrap with noop script and put elmi-to-json to the expected location in derivation itself.

you can use my thing https://github.com/turboMaCk/nix-elm-tools just note that at this point elmi-to-json itself is downloaded as a binary (darwin or linux).

domenkozar commented 5 years ago

This has been fixed by https://github.com/NixOS/nixpkgs/pull/63477

turboMaCk commented 5 years ago

just a note that elm-test was moved so it's located in elmPackages.elm-test