1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
Subject: [PATCH] Use patched rules_js and Nix-provided nodejs
By default aspect_rules_js brings a precompiled nodejs which uses a
non-nixpkgs dynamic linker. Instead use nodejs from nixpkgs. This
requires a patched rules_js as specifying npm_path fails otherwise
(see the rules_js patch).
We also require a patched rules_js because it otherwise generates and
immediately executes scripts with `#!/usr/bin/env bash`.
---
MODULE.bazel | 4 ++++
nixpkgs-toolchains/BUILD.bazel | 13 +++++++++++++
2 files changed, 17 insertions(+)
create mode 100644 nixpkgs-toolchains/BUILD.bazel
diff --git a/MODULE.bazel b/MODULE.bazel
index 4df2a500..b7525996 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -35,6 +35,10 @@ use_repo(
)
bazel_dep(name = "aspect_rules_js", version = "2.4.0")
+local_path_override(module_name = "aspect_rules_js", path = "@rules_js@")
+
+bazel_dep(name = "rules_nodejs", version = "6.3.0")
+register_toolchains("//nixpkgs-toolchains:nixpkgs_nodejs_toolchain")
npm = use_extension(
"@aspect_rules_js//npm:extensions.bzl",
diff --git a/nixpkgs-toolchains/BUILD.bazel b/nixpkgs-toolchains/BUILD.bazel
new file mode 100644
index 00000000..3b8a7940
--- /dev/null
+++ b/nixpkgs-toolchains/BUILD.bazel
@@ -0,0 +1,13 @@
+load("@rules_nodejs//nodejs:toolchain.bzl", "nodejs_toolchain")
+
+nodejs_toolchain(
+ name = "node_toolchain",
+ node_path = "@nodejs@/bin/node",
+ npm_path = "@nodejs@/bin/npm",
+)
+
+toolchain(
+ name = "nixpkgs_nodejs_toolchain",
+ toolchain = ":node_toolchain",
+ toolchain_type = "@rules_nodejs//nodejs:toolchain_type",
+)
--
2.53.0
|