Luke Granger-Brown
dd6ee53bfe
This does a bit more than advertised, since this also switches to a different set of Bazel package building infrastructure that I'm hoping will be more extensible than buildBazelPackage as it exists in nixpkgs today. In any case, the FOD here _seems_ to be much more stable than that previously produced by the old approach, but no promises :)
54 lines
1.1 KiB
Nix
54 lines
1.1 KiB
Nix
{ stdenvNoCC
|
|
, lib
|
|
, makeSetupHook
|
|
, fetchFromGitHub
|
|
, coreutils
|
|
, gnugrep
|
|
, nodejs
|
|
, yarn
|
|
, git
|
|
, cacert
|
|
}:
|
|
let
|
|
rulesNodeJS = stdenvNoCC.mkDerivation rec {
|
|
pname = "bazelbuild-rules_nodejs";
|
|
version = "5.8.5";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "bazelbuild";
|
|
repo = "rules_nodejs";
|
|
rev = version;
|
|
hash = "sha256-6UbYRrOnS93+pK4VI016gQZv2jLCzkJn6wJ4vZNCNjY=";
|
|
};
|
|
|
|
dontBuild = true;
|
|
|
|
postPatch = ''
|
|
shopt -s globstar
|
|
for i in **/*.bzl **/*.sh **/*.cjs; do
|
|
substituteInPlace "$i" \
|
|
--replace-quiet '#!/usr/bin/env bash' '#!${stdenvNoCC.shell}' \
|
|
--replace-quiet '#!/bin/bash' '#!${stdenvNoCC.shell}'
|
|
done
|
|
sed -i '/^#!/a export PATH=${lib.makeBinPath [ coreutils gnugrep ]}:$PATH' internal/node/launcher.sh
|
|
'';
|
|
|
|
installPhase = ''
|
|
cp -R . $out
|
|
'';
|
|
};
|
|
in makeSetupHook {
|
|
name = "bazelbuild-rules_nodejs-5-hook";
|
|
propagatedBuildInputs = [
|
|
nodejs
|
|
yarn
|
|
git
|
|
cacert
|
|
];
|
|
substitutions = {
|
|
inherit nodejs yarn cacert rulesNodeJS;
|
|
local_node = ./local_node;
|
|
local_yarn = ./local_yarn;
|
|
};
|
|
} ./setup-hook.sh
|