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

yarn2nix: Init at 0.1.0 #35340

Merged
merged 4 commits into from Mar 9, 2018
Merged

yarn2nix: Init at 0.1.0 #35340

merged 4 commits into from Mar 9, 2018

Conversation

manveru
Copy link
Contributor

@manveru manveru commented Feb 22, 2018

Motivation for this change

This is required to be able to build derivations using mkYarnPackage and mkYarnModules.
Unfortunately this means copying most of the source from the https://github.com/moretea/yarn2nix project, since It's not possible to load remote derivations yet.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@manveru
Copy link
Contributor Author

manveru commented Feb 22, 2018

Pinging @zimbatm and @moretea to have a look. I'm not sure how to handle meta for this.

rm -rf $out/node_modules/${pname}/node_modules

mkdir $out/bin
node ${"${src}/nix/fixup_bin.js"} $out ${lib.concatStringsSep " " publishBinsFor_}
Copy link
Member

@zimbatm zimbatm Feb 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe fixup_bin.js should be in it's own derivation to avoid needing the yarn2nix source for every mkYarnPackage invocation. it's just a thought

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really don't want to spread this out into 3 locations, I already reverted moving all of yarn2nix into nixpkgs to instead only put the .nix files in.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean writeScript "fixup_bin.js" (builtins.readFile "${src}/nix/fixup_bin.js"). It's a small optimization and it doesn't really matter right now.

@zimbatm
Copy link
Member

zimbatm commented Feb 23, 2018

It looks like there is an issue with reading the package.json from the src. Maybe it's not allowed in a strict evaluation setting. /cc @grahamc

@manveru
Copy link
Contributor Author

manveru commented Mar 4, 2018

@zimbatm so I decided to just get all the needed files into nixpkgs since all other options would either fragment the source or fail to evaluate. It's not too much hopefully :)

@zimbatm
Copy link
Member

zimbatm commented Mar 5, 2018

I'm not sure it would solve the problem for other packages that want to use yarn2nix inside of nixpkgs.

@GrahamcOfBorg build yarn2nix

@GrahamcOfBorg
Copy link

Success on x86_64-darwin (full log)

Partial log (click to expand)

no Makefile, doing nothing
installing
Processing  yarn2nix
Linked yarn2nix
post-installation fixup
strip is /nix/store/4sdh09gmvl15cy0zb6i7mbvxh5syz206-cctools-binutils-darwin/bin/strip
stripping (with command strip and flags -S) in /nix/store/9d2la1l6iqmm72rhwz28xglgrjz9vznq-yarn2nix-1.0.0/bin
patching script interpreter paths in /nix/store/9d2la1l6iqmm72rhwz28xglgrjz9vznq-yarn2nix-1.0.0
/nix/store/9d2la1l6iqmm72rhwz28xglgrjz9vznq-yarn2nix-1.0.0/node_modules/yarn2nix/bin/yarn2nix.js: interpreter directive changed from "/usr/bin/env node" to "/nix/store/7rba6g76nn731kbhyc1kka2hkrfk0v6y-nodejs-6.13.0/bin/node"
/nix/store/9d2la1l6iqmm72rhwz28xglgrjz9vznq-yarn2nix-1.0.0

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Partial log (click to expand)

Processing  yarn2nix
Linked yarn2nix
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/wgmhjrjyk9xqfkd8sh54iv5cjbsl361s-yarn2nix-1.0.0
strip is /nix/store/lvx1acn1ig1j2km8jds5x3ggh3f2wa8v-binutils-2.28.1/bin/strip
stripping (with command strip and flags -S) in /nix/store/wgmhjrjyk9xqfkd8sh54iv5cjbsl361s-yarn2nix-1.0.0/bin
patching script interpreter paths in /nix/store/wgmhjrjyk9xqfkd8sh54iv5cjbsl361s-yarn2nix-1.0.0
/nix/store/wgmhjrjyk9xqfkd8sh54iv5cjbsl361s-yarn2nix-1.0.0/node_modules/yarn2nix/bin/yarn2nix.js: interpreter directive changed from "/usr/bin/env node" to "/nix/store/5sxwzjy7mh9ilwgmkzbh0dp3xhkvgrqk-nodejs-6.13.0/bin/node"
checking for references to /build in /nix/store/wgmhjrjyk9xqfkd8sh54iv5cjbsl361s-yarn2nix-1.0.0...
/nix/store/wgmhjrjyk9xqfkd8sh54iv5cjbsl361s-yarn2nix-1.0.0

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Partial log (click to expand)

installing
Processing  yarn2nix
Linked yarn2nix
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/g2a74ljvrhvi3bar8narcn25lxxg99b5-yarn2nix-1.0.0
strip is /nix/store/b0zlxla7dmy1iwc3g459rjznx59797xy-binutils-2.28.1/bin/strip
stripping (with command strip and flags -S) in /nix/store/g2a74ljvrhvi3bar8narcn25lxxg99b5-yarn2nix-1.0.0/bin 
patching script interpreter paths in /nix/store/g2a74ljvrhvi3bar8narcn25lxxg99b5-yarn2nix-1.0.0
/nix/store/g2a74ljvrhvi3bar8narcn25lxxg99b5-yarn2nix-1.0.0/node_modules/yarn2nix/bin/yarn2nix.js: interpreter directive changed from "/usr/bin/env node" to "/nix/store/bnrrcf3204356l91iy7aijz3cw58l9g0-nodejs-6.13.0/bin/node"
checking for references to /tmp/nix-build-yarn2nix-1.0.0.drv-0 in /nix/store/g2a74ljvrhvi3bar8narcn25lxxg99b5-yarn2nix-1.0.0...

@manveru manveru mentioned this pull request Mar 9, 2018
8 tasks
@zimbatm zimbatm merged commit 3b769ea into NixOS:master Mar 9, 2018
@marsam marsam mentioned this pull request Mar 10, 2018
2 tasks
eethann pushed a commit to eethann/nixpkgs that referenced this pull request Oct 21, 2018
@manveru manveru deleted the yarn2nix branch December 12, 2019 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants