Support nixpkgs_node_configure
Is your feature request related to a problem? Please describe. using rules_node with the nixpkgs node is extremely painful and requires the workaround specified in https://github.com/bazelbuild/rules_nodejs/issues/464 / https://github.com/bazelbuild/bazel/issues/2927
Specifically:
nixpkgs_package(
name = "nixpkgs_nodejs",
build_file_content = 'exports_files(glob(["nixpkgs_nodejs/**"]))',
nix_file_content = """
with import <nixpkgs> { config = {}; overlays = []; };
runCommand "nodejs-build" { buildInputs = [ nodejs ]; } ''
mkdir -p $out/nixpkgs_nodejs
cd $out/nixpkgs_nodejs
for i in ${nodejs}/*; do ln -s $i; done
''
""",
nixopts = [
"--option",
"sandbox",
"false",
],
repository = "@nixpkgs",
)
load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories")
node_repositories(
vendored_node = "@nixpkgs_nodejs",
package_json = [":package.json"],
)
Describe the solution you'd like
Ideally this is a solved with a call to nixpkgs_node_configure
Describe alternatives you've considered ^ workaround described above
Additional context https://github.com/bazelbuild/rules_nodejs/issues/464 https://github.com/bazelbuild/bazel/issues/2927
This would be great to have. With more recent versions of rules_nodejs the following setup works.
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "cfc289523cf1594598215901154a6c2515e8bf3671fd708264a6f6aefe02bf39",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/4.4.6/rules_nodejs-4.4.6.tar.gz"],
)
nixpkgs_package(
name = "nix_node",
build_file_content = 'exports_files(glob(["nix_node/bin/**"]))',
nix_file_content = 'with import <nixpkgs> {}; linkFarm "nodejs" [ { name = "nix_node"; path = nodejs-10_x; }]',
repository = "@nixpkgs",
)
load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories")
node_repositories(
package_json = ["//typescript:package.json"],
vendored_node = "@nix_node",
)
Having a nixpkgs_node_configure that captures that would still be great.
PRs to add this are welcome.
This should go into a separate file here or a dedicated component after https://github.com/tweag/rules_nixpkgs/issues/182 to not introduce a dependency on rules_nodejs to all users of rules_nixpkgs independent of whether they use this or not.
A test case would also be good. See here for a Go example.
I started looking into this but it seems like node_repositories changed quite drastically between 4.4.6 and 5.5.3. It no longer takes package_json and vendored_node parameters. I don't really have the knowledge needed to investigate this further so I'm going to unassign myself for now.