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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/modules/languages/javascript.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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?

++ lib.optional cfg.bun.enable (cfg.bun.package)
++ lib.optional cfg.corepack.enable (pkgs.runCommand "corepack-enable" { } ''
mkdir -p $out/bin
Expand Down