-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
mkYarnPackage
: run yarn --offline build
in buildPhase
? Also, avoid IFD when packageJSON = src + "/package.json"
#296856
Comments
Don't use mkYarnPackage. It is convoluted and should at some point be replaced by a hook which can be added to any stdenv.mkDerivation package, to allow for multi-language packages too. |
|
Is there an issue open for implementing |
I don't think so |
Even if we change the underlying implementation to use hooks, I think this kind of behavior would be desired. |
See also: #296857 |
I got mkYarnPackage together with yarn2nix merged years ago. It was controversial, and nowadays I see it as a mistake, but it was the best/only tool available at the time. Now we also have fetchYarnDeps (which is output-compatible with yarn2nix, so it can be used with mkYarnPackage and any successor). |
OK I see. Since you are answering so quickly, do you know the source of the ofborg error I'm getting at: #296847 ? Quoting:
Is it an IFD issue I didn't experience locally? Same error happens in #296850 |
Yes, when using mkYarnPackage within nixpkgs, the packageJSON must be set to a in-tree copy of the package.json, otherwise it will attempt to import the package.json from the src to set the package name, version and other inputs, which results in IFD. |
Hmm interesting, because the |
misunderstood the question That's because fetchYarnDeps is not reading the contents of yarnLock, it is merely accessing the path of src/yarn.lock, but the contents are only read in the fetchYarnDeps derivation (not the evaluation). |
OK I see. Thanks! It still a bit weird because both documentation doesn't mention It's also a big difference from |
buildNpmPackage does not deal with package.json during eval-time, which also means it can not automatically determine a package version and pname. Basically, for buildNpmPackage the entire npm build tree is invisible to nix (and also npm thinks it's running in a more normal environment), while mkYarnPackage creates lots of small derivations. |
yarn --offline build
in buildPhase
?yarn --offline build
in buildPhase
? Also, avoid IFD when packageJSON = src + "/package.json"
yarn --offline build
in buildPhase
? Also, avoid IFD when packageJSON = src + "/package.json"yarn --offline build
in buildPhase
? Also, avoid IFD when packageJSON = src + "/package.json"
yarn --offline build
in buildPhase
? Also, avoid IFD when packageJSON = src + "/package.json"
mkYarnPackage
: run yarn --offline build
in buildPhase
? Also, avoid IFD when packageJSON = src + "/package.json"
Linking here #318015 for case someone reads this. |
I'm closing this as this is mostly addressed by #318015 . |
Today I packaged vim-language-server with
mkYarnPackage
, first time I ever used this Nix function. I noticed after reading the source code and the docs, that there is nobuildPhase
defined by default, whereasbuildNpmPackage
runsnpm run build
by default.For
mkYarnPackage
, the defaultbuildPhase
I'd expect it to run is:According to a simple
git grep
survey I did with:There are 37 files using
mkYarnPackage
.21
of them are running some form ofyarn build
, and hence probably could have package these packages with a better experience with that defaultbuildPhase
.ccing people I found with
git blame
who touchedmkYarnPackage
before: @happysalada @WilliButz @yu-re-kaThe text was updated successfully, but these errors were encountered: