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

Fix: sync nodejs versions #1202

Merged
merged 1 commit into from
May 19, 2024

Conversation

soundofspace
Copy link
Contributor

This fixes yarn using a different nodejs version (partially solves #637). This doesn't work if yarn pkg is a nodePackage. Pnpm also has the same problem since it's a nodePackage, not sure how to fix that, seems to use the first node version that is installed.

@@ -218,7 +218,7 @@ in
]
++ lib.optional cfg.npm.enable (cfg.npm.package)
++ lib.optional cfg.pnpm.enable (cfg.pnpm.package)
++ lib.optional cfg.yarn.enable (cfg.yarn.package)
++ lib.optional cfg.yarn.enable (cfg.yarn.package.override { nodejs = cfg.package; })
Copy link
Member

Choose a reason for hiding this comment

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

do we also need this for pnpm?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea pnpm has the same problem but this override only works because yarn package supports it. Pnpm is a nodePackage which sadly doesn't support this (same problem if you would use nodePackage.yarn instead of yarn)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only way I found to fix that was using overlay to fix all nodejs to specific version

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Underlying nix issue: NixOS/nixpkgs#145634

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Something like this also works: cfg.package.pkgs.pnpm. This installs pnpm with the correct node version, but not sure if all node pkgs support this (tested with pkgs.nodejs_21;), will do some more testing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doesn't work with nodejs-slim pkg so not sure what the best way forward is here. Supporting overlays seems like the only way to support all different pkgs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Commented workarounds in original issue aswel so people can still use this until a proper fix is ready. Do you reckon moving away from slim nodejs is a good solution?

@domenkozar domenkozar merged commit 32983f6 into cachix:main May 19, 2024
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

Successfully merging this pull request may close these issues.

2 participants