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
yarn: add yarnpkg binary to outputs and use nodejs dependency #35063
Conversation
Oh, wait, there's also a |
122d4da
to
c2e197a
Compare
I instead deleted the Further motivation: I want to be able to usefully apply source patches to this package. Unfortunately, yarn's tar.gz files both in npm and github releases are a concatenated "dist" built with their own gulp, webpack, and shell scripts. I overrode the package to get the actual source, and the default build steps worked just fine. |
@GrahamcOfBorg build yarn |
Success on x86_64-linux (full log) Partial log (click to expand)
|
Success on x86_64-darwin (full log) Partial log (click to expand)
|
Success on aarch64-linux (full log) Partial log (click to expand)
|
@@ -1,26 +0,0 @@ | |||
{ stdenv, nodejs, fetchzip, makeWrapper }: | |||
|
|||
stdenv.mkDerivation rec { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, this package was intentionally added by @offlinehacker
I have not yet understood, how building |
Sorry, I wasn't clear: that collision is not addressed by this PR, which in effect just adds a new executable to the package's output. (e: I mistakenly thought at first that it fixed another problem.) I hope that building from the full source will help me create and maintain a private patched yarn package, but to be honest I'm having trouble making that work at the moment. |
Also, I may not have explained this properly: the "source" tarballs used by the deleted packaged and served from npm do not contain the actual source as it is stored in git; they're produced by a build process. |
Updated for version 1.6.0. |
@GrahamcOfBorg build nodePackages.yarn |
owner = "yarnpkg"; | ||
repo = "yarn"; | ||
rev = "v${oldAttrs.version}"; | ||
sha256 = "1h1qcgyx53hxkmg1z34k9b8gc3w0l670mb3jgmqlcbs6vjlqxbr8"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you plan to keep this checksum up-to-date when node-packages-v6.nix
is updated automatically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would need to be updated like any other package, which is not ideal.
installPhase = '' | ||
mkdir -p $out/{bin,libexec/yarn/} | ||
cp -R . $out/libexec/yarn | ||
makeWrapper $out/libexec/yarn/bin/yarn.js $out/bin/yarn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could your problem be also solved by adding a yarnpkg
symlink?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makeWrapper
call also does not work on macOS because shebangs executables are not allowed to be scripts itself. It should use the nodejs binary instead for wrapping.
Success on aarch64-linux (full log) Attempted: nodePackages.yarn Partial log (click to expand)
|
Success on x86_64-linux (full log) Attempted: nodePackages.yarn Partial log (click to expand)
|
Success on x86_64-darwin (full log) Attempted: nodePackages.yarn Partial log (click to expand)
|
I'm closing this. My goal was to make it possible to add patches from my company's fork of yarn on top of the yarn package, but changing its src attribute to the actual source of the project still doesn't reach that goal: it turns out that I've made a private package which I believe achieves this goal. After I'm sure, I'll upstream any changes I think would actually be improvements. |
Motivation for this change
My company makes a few open source nodejs tools that call out to the nodejs package manage yarn, but some users of those tools also have hadoop installed on their systems, which also provides a binary named
yarn
. As that link indicates, this conflict was addressed by the node yarn developers by adding an additional identical binary calledyarnpkg
, and we use that solution by having our tools run yarn by callingyarnpkg
.For assorted reasons, I'd like us to start packaging yarn internally using nix, but in order to test and work on those externally shipped tools, we need the
yarnpkg
binary, and I don't see any reason why this package can't include it.While making that change, I noticed that the yarn commands were still looking for the "system" node, so I added an argument to theNever mind about that! I was confused.makeWrapper
call to fix that.Things done
build-use-sandbox
innix.conf
on non-NixOS)./result/bin/
)