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

How to handle conditional / @patch dependencies #52

Open
sir4ur0n opened this issue Nov 25, 2022 · 2 comments
Open

How to handle conditional / @patch dependencies #52

sir4ur0n opened this issue Nov 25, 2022 · 2 comments

Comments

@sir4ur0n
Copy link

Hi,

I recently tried to migrate the VS Code extension build of Nickel to use yarn-plugin-nixify.
As you can see, the build succeeds for Linux but fails for Darwin OSes.

       > patching sources
       > updateAutotoolsGnuConfigScriptsPhase
       > configuring
       > ➤ YN0000: ┌ Resolution step
       > ➤ YN0000: └ Completed
       > ➤ YN0000: ┌ Fetch step
       > ➤ YN0056: │ fsevents@patch:fsevents@npm%3A2.3.2#~builtin<compat/fsevents>::version=2.3.2&hash=df0bf1: Cache entry required but missing for fsevents@patch:fsevents@npm%3A2.3.2#~builtin<compat/fsevents>::version=2.3.2&hash=df0bf1
       > ➤ YN0013: │ 375 packages were already cached, one had to be fetched (fsevents@patch:fsevents@npm%3A2.3.2#~builtin<compat/fsevents>::version=2.3.2&hash=df0bf1)
       > ➤ YN0000: └ Completed
       > ➤ YN0000: Failed with errors in 0s 114ms

By looking into yarn.lock we see the following about fsevents:

"fsevents@npm:~2.3.1":
  version: 2.3.2
  resolution: "fsevents@npm:2.3.2"
  dependencies:
    node-gyp: latest
  checksum: 97ade64e75091afee5265e6956cb72ba34db7819b4c3e94c431d4be2b19b8bb7a2d4116da417950c3425f17c8fe693d25e20212cac583ac1521ad066b77ae31f
  conditions: os=darwin
  languageName: node
  linkType: hard

"fsevents@patch:fsevents@~2.3.1#~builtin<compat/fsevents>":
  version: 2.3.2
  resolution: "fsevents@patch:fsevents@npm%3A2.3.2#~builtin<compat/fsevents>::version=2.3.2&hash=df0bf1"
  dependencies:
    node-gyp: latest
  conditions: os=darwin
  languageName: node
  linkType: hard

Notice the conditions: os=darwin, and the fsevents@patch:fsevents@~2.3.1#~builtin<compat/fsevents> package.

But to my surprise, when we look into the generated yarn-project.nix:

  • there is no mention whatsoever of darwin
  • only fsevents@npm:2.3.2 is present, the other one is absent!

So I guess I have 3 questions 😅

  • how are conditional dependencies supposed to be handled by this plugin?
  • why isn't fsevents@patch:fsevents@~2.3.1#~builtin<compat/fsevents> present in the generated yarn-project.nix file?
  • would you have any idea how to fix the original problem, in case the 2 previous questions are not enough to solve this? 🙏

I searched in the documentation, code and issues, but with poor results 😞
The only part that looks interesting is in generate.ts function collectTree:
https://github.com/stephank/yarn-plugin-nixify/blob/main/src/generate.ts#L149

but that does not help me understand what I should do to make this work.

Please let me know if I can provide any additional information to help investigate!

@adrian-gierakowski
Copy link
Contributor

adrian-gierakowski commented Nov 25, 2022

@sir4ur0n you might want to try https://github.com/madjam002/yarnpnp2nix as it seems like it supports conditions

Or you could port the implementation to here

@nekowinston
Copy link

I ran into this problem as well (see the linked issue above), and I don't really know what changed, but it works with Yarn v4 for me!

supportedArchitectures:
  os: [linux, darwin, win32]
  cpu: [x64, arm64]

See catppuccin/vscode#215, ef47700 failed, but adding supportedArchitectures fixed it for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants