bazel: make more tools available in customBash.

This commit is contained in:
Mathieu Boespflug 2018-07-14 17:36:42 +02:00 committed by Profpatsch
parent 402ee4e9ea
commit 5ab07a8041

View File

@ -1,4 +1,6 @@
{ stdenv, lib, fetchurl, runCommand, jdk, zip, unzip, bash, writeCBin, coreutils, makeWrapper, which, python, gnused
{ stdenv, lib, fetchurl, runCommand, makeWrapper
, jdk, zip, unzip, bash, writeCBin, coreutils
, which, python, gnused, gnugrep, findutils
# Always assume all markers valid (don't redownload dependencies).
# Also, don't clean up environment variables.
, enableNixHacks ? false
@ -6,16 +8,21 @@
, libcxx, CoreFoundation, CoreServices, Foundation
}:
let srcDeps = stdenv.lib.singleton (
fetchurl {
url = "https://github.com/google/desugar_jdk_libs/archive/f5e6d80c6b4ec6b0a46603f72b015d45cf3c11cd.zip";
sha256 = "c80f3f3d442d8a6ca7adc83f90ecd638c3864087fdd6787ffac070b6f1cc8f9b";
}
);
distDir = runCommand "bazel-deps" {} ''
mkdir -p $out
for i in ${builtins.toString srcDeps}; do cp $i $out/$(stripHash $i); done
'';
let
srcDeps = stdenv.lib.singleton (
fetchurl {
url = "https://github.com/google/desugar_jdk_libs/archive/f5e6d80c6b4ec6b0a46603f72b015d45cf3c11cd.zip";
sha256 = "c80f3f3d442d8a6ca7adc83f90ecd638c3864087fdd6787ffac070b6f1cc8f9b";
}
);
distDir = runCommand "bazel-deps" {} ''
mkdir -p $out
for i in ${builtins.toString srcDeps}; do cp $i $out/$(stripHash $i); done
'';
defaultShellPath = lib.makeBinPath [ bash coreutils findutils gnugrep gnused which ];
in
stdenv.mkDerivation rec {
@ -52,7 +59,7 @@ stdenv.mkDerivation rec {
int main(int argc, char *argv[]) {
char *path = getenv("PATH");
char *pathToAppend = "${lib.makeBinPath [ coreutils gnused ]}";
char *pathToAppend = "${defaultShellPath}";
char *newPath;
if (path != NULL) {
int length = strlen(path) + 1 + strlen(pathToAppend) + 1;
@ -140,7 +147,7 @@ stdenv.mkDerivation rec {
# Save paths to hardcoded dependencies so Nix can detect them.
postFixup = ''
mkdir -p $out/nix-support
echo "${customBash} ${gnused} ${coreutils}" > $out/nix-support/depends
echo "${customBash} ${defaultShellPath}" > $out/nix-support/depends
'';
dontStrip = true;