!NhAsaYbbgmzHtXTPQJ:funklause.de

Nix NodeJS

207 Members
58 Servers

Load older messages


SenderMessageTime
22 Apr 2023
@aktaboot:tchncs.deaktaboot joined the room.17:38:50
@aktaboot:tchncs.deaktaboot

Hello,

Any idea how to go around fixing such an error :

error: builder for '/nix/store/y6cnwy9y1s600xvpcxjnvc62af1b9i54-offline.drv' failed with exit code 1;
       last 10 log lines:
       > building
       > SyntaxError: Unknown token: { line: 5, col: 12, type: 'NUMBER', value: 4 } 5:12 in lockfile
       >     at Parser.unexpected (/nix/store/8b0d75k79ldnx2rqri9q17mb52gdk9hb-prefetch-yarn-deps/libexec/yarnpkg-lockfile.js:5064:11)
       >     at Parser.parse (/nix/store/8b0d75k79ldnx2rqri9q17mb52gdk9hb-prefetch-yarn-deps/libexec/yarnpkg-lockfile.js:5193:14)
       >     at Parser.parse (/nix/store/8b0d75k79ldnx2rqri9q17mb52gdk9hb-prefetch-yarn-deps/libexec/yarnpkg-lockfile.js:5147:28)
       >     at Parser.parse (/nix/store/8b0d75k79ldnx2rqri9q17mb52gdk9hb-prefetch-yarn-deps/libexec/yarnpkg-lockfile.js:5147:28)
       >     at parse (/nix/store/8b0d75k79ldnx2rqri9q17mb52gdk9hb-prefetch-yarn-deps/libexec/yarnpkg-lockfile.js:5262:17)
       >     at module.exports.exports.default (/nix/store/8b0d75k79ldnx2rqri9q17mb52gdk9hb-prefetch-yarn-deps/libexec/yarnpkg-lockfile.js:4835:96)
       >     at prefetchYarnDeps (/nix/store/8b0d75k79ldnx2rqri9q17mb52gdk9hb-prefetch-yarn-deps/libexec/index.js:129:28)
       >     at main (/nix/store/8b0d75k79ldnx2rqri9q17mb52gdk9hb-prefetch-yarn-deps/libexec/index.js:183:9)
       For full logs, run 'nix log /nix/store/y6cnwy9y1s600xvpcxjnvc62af1b9i54-offline.drv'.

I tried running the fixup_yarn_lock on the yarn.lock file in configurePhase but it doesn't make it better

17:41:27
@aktaboot:tchncs.deaktaboot https://0x0.st/HK-k.nix 17:42:25
@lily:lily.flowersLily Foster
In reply to @aktaboot:tchncs.de

Hello,

Any idea how to go around fixing such an error :

error: builder for '/nix/store/y6cnwy9y1s600xvpcxjnvc62af1b9i54-offline.drv' failed with exit code 1;
       last 10 log lines:
       > building
       > SyntaxError: Unknown token: { line: 5, col: 12, type: 'NUMBER', value: 4 } 5:12 in lockfile
       >     at Parser.unexpected (/nix/store/8b0d75k79ldnx2rqri9q17mb52gdk9hb-prefetch-yarn-deps/libexec/yarnpkg-lockfile.js:5064:11)
       >     at Parser.parse (/nix/store/8b0d75k79ldnx2rqri9q17mb52gdk9hb-prefetch-yarn-deps/libexec/yarnpkg-lockfile.js:5193:14)
       >     at Parser.parse (/nix/store/8b0d75k79ldnx2rqri9q17mb52gdk9hb-prefetch-yarn-deps/libexec/yarnpkg-lockfile.js:5147:28)
       >     at Parser.parse (/nix/store/8b0d75k79ldnx2rqri9q17mb52gdk9hb-prefetch-yarn-deps/libexec/yarnpkg-lockfile.js:5147:28)
       >     at parse (/nix/store/8b0d75k79ldnx2rqri9q17mb52gdk9hb-prefetch-yarn-deps/libexec/yarnpkg-lockfile.js:5262:17)
       >     at module.exports.exports.default (/nix/store/8b0d75k79ldnx2rqri9q17mb52gdk9hb-prefetch-yarn-deps/libexec/yarnpkg-lockfile.js:4835:96)
       >     at prefetchYarnDeps (/nix/store/8b0d75k79ldnx2rqri9q17mb52gdk9hb-prefetch-yarn-deps/libexec/index.js:129:28)
       >     at main (/nix/store/8b0d75k79ldnx2rqri9q17mb52gdk9hb-prefetch-yarn-deps/libexec/index.js:183:9)
       For full logs, run 'nix log /nix/store/y6cnwy9y1s600xvpcxjnvc62af1b9i54-offline.drv'.

I tried running the fixup_yarn_lock on the yarn.lock file in configurePhase but it doesn't make it better

Can you share the yarn.lock? This is complaining about a syntax error in it and is coming from the upstream yarnpkg parser itself
19:52:02
@aktaboot:tchncs.deaktaboot
In reply to @lily:lily.flowers
Can you share the yarn.lock? This is complaining about a syntax error in it and is coming from the upstream yarnpkg parser itself
https://github.com/toeverything/AFFiNE/blob/v0.5.3/yarn.lock this is the yarn.lock
19:59:39
@lily:lily.flowersLily FosterOh this is a yarn 2 lockfile20:19:14
@lily:lily.flowersLily FosterWe, uh, should probably make tooling to handle those soon20:19:30
23 Apr 2023
@raitobezarius:matrix.orgraitobezarius We can discuss it here Lily Foster indeed 14:39:01
@phaer:matrix.orgphaer joined the room.15:06:40
@lily:lily.flowersLily Foster
In reply to @raitobezarius:matrix.org
We can discuss it here Lily Foster indeed

Apologies for possibly incoherent, run-on sentence brain dump (also Winter may also have some thoughts/ideas/plans, but this is my current understanding):

Initially, we need to go ahead and get https://github.com/NixOS/nixpkgs/pull/206476 merged, and then get https://github.com/NixOS/nixpkgs/pull/206477 and https://github.com/NixOS/nixpkgs/pull/214454 cleaned up for merge (and also probably pull in https://github.com/winterqt/nixpkgs/commit/f78408065637e194fce1bfc3820954baef9efb74 to the latter PR before rebasing and cleaning it up)

#206477 needs some minor bitrot figured out and I want to actually migrate the npm patching to the nodejs derivation itself, so handling it between versions is not a hassle and so that we aren't having to juggle getting a patched nodejs in all the right places (like manually prepending it to nativeBuildInputs...). I sorta explained what I was thinking about that here: https://github.com/NixOS/nixpkgs/pull/206477#discussion_r1157922584

The head commit on #214454 and the other commit I linked is needed to fix some problems with assumptions the fetcher makes, both by correcting some assumptions and doing some changes in a lockfile fixup step to map onto some assumptions where reasonable (e.g. why bother fetching a dep more than once just because one node in the dep tree has a different hash type...)

For npm workspaces, dotlambda tried adding an arg to buildNpmPackage which adds a workspace package to build and that actually kinda seems to sorta work (but other monorepo types like lerna and such are probably far-future goals for now because those will basically need their own specialized handling in both fetcher and builder and aren't really that worth it if they are published to registry, since our tooling can already grok most stuff uploaded to the registry, which lerna and such generation sane npm tarballs for that don't require lerna iirc)

We really should add a fetchNpmRegistry for getting a tarball from the registry, kinda like fetchPypi. It's certainly the simplest thing that I would like done, but would be a helpful one for stubborn from-source packages that have acceptable tarballs in the registry

For yarn berry lockfile handling, we need to look closely at the new format and see what's different and if we even need to make that many updates to our existing fetcher. It's possible all it needs to work is to pull the newer lockfile parser (right now it pulls the legacy yarnpkg lockfile parser). We will also need yarn berry packaged: https://github.com/NixOS/nixpkgs/pull/214699

For pnpm lockfile handling, I have not looked at this at all. Ideally it's just a new format to parse and can map onto how we generally make fetchers already (even better: making it another frontend to the existing prefetch-npm-deps fetcher) and then everything after Just Works when called with pnpm (but my experience with nodejs has been every little thing requires a significant amount of debugging hell to untangle...)

We currently only look for package-lock.json in buildNpmPackage for git deps with lifecycle scripts, and I'm not entirely certain yet how we should appropriately handle git deps with heterogeneous lockfiles (we'd probably have to make pacote intelligently call the correct builder I guess depending on what lockfile is available (we're patching npm/pacote already anyway) and maybe make it so prefetch-npm-deps can parse several different lockfiles and fetch extras from git deps properly with different lockfiles). Also some projects lack lockfiles entirely and there is little hope for those. We may want some way to override lockfiles for deps deep in the tree for those and for an escape hatch to support git deps with unsupported lockfiles

We probably will want to continue adding more documentation, to describe corner cases and how to account for them (the diagnostic messages on build failure already do some of that and it's not so bad right now. Some of the above future-stuff will just need it)

15:07:20
@lily:lily.flowersLily Foster(And I would just say screw git deps to simplify quite a lot, but they're frustratingly common)15:16:17
@arteneko:matrix.org$nyx (it/its) left the room.16:30:10
24 Apr 2023
@lily:lily.flowersLily Foster Oh also at some point we need to get a migration plan for the nodePackages set, because node2nix makes me sad 15:50:40
@ambroisie:belanyi.fr@ambroisie:belanyi.fr
In reply to @lily:lily.flowers

Apologies for possibly incoherent, run-on sentence brain dump (also Winter may also have some thoughts/ideas/plans, but this is my current understanding):

Initially, we need to go ahead and get https://github.com/NixOS/nixpkgs/pull/206476 merged, and then get https://github.com/NixOS/nixpkgs/pull/206477 and https://github.com/NixOS/nixpkgs/pull/214454 cleaned up for merge (and also probably pull in https://github.com/winterqt/nixpkgs/commit/f78408065637e194fce1bfc3820954baef9efb74 to the latter PR before rebasing and cleaning it up)

#206477 needs some minor bitrot figured out and I want to actually migrate the npm patching to the nodejs derivation itself, so handling it between versions is not a hassle and so that we aren't having to juggle getting a patched nodejs in all the right places (like manually prepending it to nativeBuildInputs...). I sorta explained what I was thinking about that here: https://github.com/NixOS/nixpkgs/pull/206477#discussion_r1157922584

The head commit on #214454 and the other commit I linked is needed to fix some problems with assumptions the fetcher makes, both by correcting some assumptions and doing some changes in a lockfile fixup step to map onto some assumptions where reasonable (e.g. why bother fetching a dep more than once just because one node in the dep tree has a different hash type...)

For npm workspaces, dotlambda tried adding an arg to buildNpmPackage which adds a workspace package to build and that actually kinda seems to sorta work (but other monorepo types like lerna and such are probably far-future goals for now because those will basically need their own specialized handling in both fetcher and builder and aren't really that worth it if they are published to registry, since our tooling can already grok most stuff uploaded to the registry, which lerna and such generation sane npm tarballs for that don't require lerna iirc)

We really should add a fetchNpmRegistry for getting a tarball from the registry, kinda like fetchPypi. It's certainly the simplest thing that I would like done, but would be a helpful one for stubborn from-source packages that have acceptable tarballs in the registry

For yarn berry lockfile handling, we need to look closely at the new format and see what's different and if we even need to make that many updates to our existing fetcher. It's possible all it needs to work is to pull the newer lockfile parser (right now it pulls the legacy yarnpkg lockfile parser). We will also need yarn berry packaged: https://github.com/NixOS/nixpkgs/pull/214699

For pnpm lockfile handling, I have not looked at this at all. Ideally it's just a new format to parse and can map onto how we generally make fetchers already (even better: making it another frontend to the existing prefetch-npm-deps fetcher) and then everything after Just Works when called with pnpm (but my experience with nodejs has been every little thing requires a significant amount of debugging hell to untangle...)

We currently only look for package-lock.json in buildNpmPackage for git deps with lifecycle scripts, and I'm not entirely certain yet how we should appropriately handle git deps with heterogeneous lockfiles (we'd probably have to make pacote intelligently call the correct builder I guess depending on what lockfile is available (we're patching npm/pacote already anyway) and maybe make it so prefetch-npm-deps can parse several different lockfiles and fetch extras from git deps properly with different lockfiles). Also some projects lack lockfiles entirely and there is little hope for those. We may want some way to override lockfiles for deps deep in the tree for those and for an escape hatch to support git deps with unsupported lockfiles

We probably will want to continue adding more documentation, to describe corner cases and how to account for them (the diagnostic messages on build failure already do some of that and it's not so bad right now. Some of the above future-stuff will just need it)

Would love to see pnpm handled soon!
18:36:30
@ambroisie:belanyi.fr@ambroisie:belanyi.frI had just found a workaround for Woodpecker's WebUI which migrated from yarn (by using a tool to convert pnpm lock to yarn lock format) 18:36:30
@ambroisie:belanyi.fr@ambroisie:belanyi.frAnd the following week they bumped their version of pnpm which isn't supported by the tool :'(18:36:31
@ambroisie:belanyi.fr@ambroisie:belanyi.frGiven that that tool exists though, I do believe it should be possible to add it to nixpkgs (somewhat) easily 18:36:31
* @ambroisie:belanyi.fr@ambroisie:belanyi.fr has the confidence of somebody who never worked in JS18:36:32
@hexa:lossy.networkhexa
In reply to @ambroisie:belanyi.fr
Would love to see pnpm handled soon!
be the change you want to see in the world ig 😄
20:15:05
@ambroisie:belanyi.fr@ambroisie:belanyi.fr
In reply to @hexa:lossy.network
be the change you want to see in the world ig 😄
I have yet to allocate enough time for this yak shave
20:17:03
@hexa:lossy.networkhexaso does everyone else 🙂20:17:18
@ambroisie:belanyi.fr@ambroisie:belanyi.frLiterally my only experience with JS is packaging WebUIs for services I wanted to run on NixOS 🙃 20:17:40
@lily:lily.flowersLily Foster
In reply to @ambroisie:belanyi.fr
Given that that tool exists though, I do believe it should be possible to add it to nixpkgs (somewhat) easily
Yeah stuff like that can at a minimum be short-term fixes. Ideally we'd be able to parse them natively with our tooling, and a quick look at the lockfile format does seem to indicate it's very possible. I'm not sure if it can handle npm's cacache or anything though and we'd need to write a builder for it probably
20:28:26
@ambroisie:belanyi.fr@ambroisie:belanyi.frYes no, I meant that if the tool can do the translation offline then we can do it in Nix 20:29:01
@ambroisie:belanyi.fr@ambroisie:belanyi.frDidn't make myself clear, sorry 20:29:09
@lily:lily.flowersLily FosterAh, thanks for the clarification20:29:47
@ambroisie:belanyi.fr@ambroisie:belanyi.frNPM has a CA cache? 20:29:49
@lily:lily.flowersLily Foster
In reply to @ambroisie:belanyi.fr
NPM has a CA cache?
cacache is their cache format for downloads and such (I think it's short for "content-addressed cache" but I'd have to look it up to be sure). This is how fetchNpmDeps stores dependencies so that npm can naturally pick up and deal with them offline
20:31:35
25 Apr 2023
@lily:lily.flowersLily Fosterhttps://github.com/NixOS/nixpkgs/pull/206476 has been merged 🎉 I'll try to clean up the other two PRs tomorrow or Wednesday00:28:43
28 Apr 2023
@drupol:matrix.orgPol changed their profile picture.08:42:58

Show newer messages


Back to Room ListRoom Version: 6