Loading pkgs/development/tools/build-managers/bazel/bazel_7/default.nix +110 −88 Original line number Diff line number Diff line Loading @@ -100,33 +100,40 @@ let unzip which zip runJdk makeWrapper ]; # Bootstrap an existing Bazel so we can vendor deps with vendor mode bazel_bootstrap = stdenv.mkDerivation rec { name = "bazel_bootstrap"; bazelBootstrap = stdenv.mkDerivation rec { name = "bazelBootstrap"; src = if stdenv.hostPlatform.system == "x86_64-linux" then fetchurl { src = if stdenv.hostPlatform.system == "x86_64-linux" then fetchurl { url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel_nojdk-${version}-linux-x86_64"; hash = "sha256-05fHtz47OilpOVYawB17VRVEDpycfYTIHBmwYCOyPjI="; } else if stdenv.hostPlatform.system == "aarch64-linux" then fetchurl { } else if stdenv.hostPlatform.system == "aarch64-linux" then fetchurl { url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel_nojdk-${version}-linux-arm64"; hash = "sha256-olrlIia/oXWleXp12E+LGXv+F1m4/S4jj/t7p2/xGdM="; } else if stdenv.hostPlatform.system == "x86_64-darwin" then fetchurl { url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel_nojdk-${version}-darwin-x86_64"; } else if stdenv.hostPlatform.system == "x86_64-darwin" then fetchurl { url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel-${version}-darwin-x86_64"; hash = "sha256-e5RRZTrhzoTMk2NRRl9m2K5+h1/+5mJNW2vF8h0uftc="; } else fetchurl { # stdenv.hostPlatform.system == "aarch64-darwin" url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel_nojdk-${version}-darwin-arm64"; hash = "sha256-ciNBdqm+cIrNR1Wu2wt+wGGb6m9i9aE8LhRqL4BJ0Y4="; } else fetchurl { # stdenv.hostPlatform.system == "aarch64-darwin" url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel-${version}-darwin-arm64"; hash = "sha256-mB+CpHC60TSTIrb1HJxv+gqikdqxAU+sQRVDwS5mHf8="; }; nativeBuildInputs = defaultShellUtils; buildInputs = [ stdenv.cc.cc autoPatchelfHook ]; ] ++ lib.optional (!stdenv.hostPlatform.isDarwin) autoPatchelfHook; dontUnpack = true; dontPatch = true; Loading @@ -151,7 +158,7 @@ let bazelFhs = buildFHSEnv { name = "bazel"; targetPkgs = _: [ bazel_bootstrap ]; targetPkgs = _: [ bazelBootstrap ]; runScript = "bazel"; }; Loading @@ -159,7 +166,11 @@ let # See https://bazel.build/versions/7.3.0/external/vendor for details. # Note that it may be possible to vendor less than the full set of deps in # the future, as this is approximately 16GB. bazelDeps = stdenv.mkDerivation { bazelDeps = let bazelForDeps = if stdenv.hostPlatform.isDarwin then bazelBootstrap else bazelFhs; in stdenv.mkDerivation { name = "bazelDeps"; inherit src version; sourceRoot = "."; Loading @@ -175,7 +186,8 @@ let ]; nativeBuildInputs = [ unzip bazelFhs runJdk bazelForDeps ]; configurePhase = '' runHook preConfigure Loading @@ -191,8 +203,8 @@ let buildPhase = '' runHook preBuild export HOME=$TMP (cd bazel_src; ${bazelFhs}/bin/bazel --server_javabase=${runJdk} mod deps --curses=no; ${bazelFhs}/bin/bazel --server_javabase=${runJdk} vendor \ (cd bazel_src; ${bazelForDeps}/bin/bazel --server_javabase=${runJdk} mod deps --curses=no; ${bazelForDeps}/bin/bazel --server_javabase=${runJdk} vendor src:bazel_nojdk \ --curses=no \ --vendor_dir ../vendor_dir \ --verbose_failures \ Loading Loading @@ -225,7 +237,16 @@ let ''; outputHashMode = "recursive"; outputHash = "sha256-GjktM25K4OPrww1o9jB38h0FwJrcJo7TR0x0owZV9I0="; outputHash = if stdenv.hostPlatform.system == "x86_64-linux" then "sha256-GjktM25K4OPrww1o9jB38h0FwJrcJo7TR0x0owZV9I0=" else if stdenv.hostPlatform.system == "aarch64-linux" then "sha256-T7vVWLlRzhaWneKMgMdgjUpBwRuGZ9ZFtD2AQvH9krI=" else if stdenv.hostPlatform.system == "aarch64-darwin" then "sha256-zv39lLMwfOr0MfK8dZ0alEwXpWdf97XEc6ciAoO4OK0=" else # x86_64-darwin lib.fakeSha256; outputHashAlgo = "sha256"; }; Loading Loading @@ -647,6 +668,7 @@ stdenv.mkDerivation rec { #!${runtimeShell} -e exit 1 EOF chmod +x tools/bazel # first call should fail if tools/bazel is used Loading Loading @@ -701,6 +723,6 @@ stdenv.mkDerivation rec { # tests = callPackage ./tests.nix { inherit Foundation bazelDeps bazel_self; }; # For ease of debugging inherit bazelDeps bazelFhs; inherit bazelDeps bazelFhs bazelBootstrap; }; } Loading
pkgs/development/tools/build-managers/bazel/bazel_7/default.nix +110 −88 Original line number Diff line number Diff line Loading @@ -100,33 +100,40 @@ let unzip which zip runJdk makeWrapper ]; # Bootstrap an existing Bazel so we can vendor deps with vendor mode bazel_bootstrap = stdenv.mkDerivation rec { name = "bazel_bootstrap"; bazelBootstrap = stdenv.mkDerivation rec { name = "bazelBootstrap"; src = if stdenv.hostPlatform.system == "x86_64-linux" then fetchurl { src = if stdenv.hostPlatform.system == "x86_64-linux" then fetchurl { url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel_nojdk-${version}-linux-x86_64"; hash = "sha256-05fHtz47OilpOVYawB17VRVEDpycfYTIHBmwYCOyPjI="; } else if stdenv.hostPlatform.system == "aarch64-linux" then fetchurl { } else if stdenv.hostPlatform.system == "aarch64-linux" then fetchurl { url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel_nojdk-${version}-linux-arm64"; hash = "sha256-olrlIia/oXWleXp12E+LGXv+F1m4/S4jj/t7p2/xGdM="; } else if stdenv.hostPlatform.system == "x86_64-darwin" then fetchurl { url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel_nojdk-${version}-darwin-x86_64"; } else if stdenv.hostPlatform.system == "x86_64-darwin" then fetchurl { url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel-${version}-darwin-x86_64"; hash = "sha256-e5RRZTrhzoTMk2NRRl9m2K5+h1/+5mJNW2vF8h0uftc="; } else fetchurl { # stdenv.hostPlatform.system == "aarch64-darwin" url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel_nojdk-${version}-darwin-arm64"; hash = "sha256-ciNBdqm+cIrNR1Wu2wt+wGGb6m9i9aE8LhRqL4BJ0Y4="; } else fetchurl { # stdenv.hostPlatform.system == "aarch64-darwin" url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel-${version}-darwin-arm64"; hash = "sha256-mB+CpHC60TSTIrb1HJxv+gqikdqxAU+sQRVDwS5mHf8="; }; nativeBuildInputs = defaultShellUtils; buildInputs = [ stdenv.cc.cc autoPatchelfHook ]; ] ++ lib.optional (!stdenv.hostPlatform.isDarwin) autoPatchelfHook; dontUnpack = true; dontPatch = true; Loading @@ -151,7 +158,7 @@ let bazelFhs = buildFHSEnv { name = "bazel"; targetPkgs = _: [ bazel_bootstrap ]; targetPkgs = _: [ bazelBootstrap ]; runScript = "bazel"; }; Loading @@ -159,7 +166,11 @@ let # See https://bazel.build/versions/7.3.0/external/vendor for details. # Note that it may be possible to vendor less than the full set of deps in # the future, as this is approximately 16GB. bazelDeps = stdenv.mkDerivation { bazelDeps = let bazelForDeps = if stdenv.hostPlatform.isDarwin then bazelBootstrap else bazelFhs; in stdenv.mkDerivation { name = "bazelDeps"; inherit src version; sourceRoot = "."; Loading @@ -175,7 +186,8 @@ let ]; nativeBuildInputs = [ unzip bazelFhs runJdk bazelForDeps ]; configurePhase = '' runHook preConfigure Loading @@ -191,8 +203,8 @@ let buildPhase = '' runHook preBuild export HOME=$TMP (cd bazel_src; ${bazelFhs}/bin/bazel --server_javabase=${runJdk} mod deps --curses=no; ${bazelFhs}/bin/bazel --server_javabase=${runJdk} vendor \ (cd bazel_src; ${bazelForDeps}/bin/bazel --server_javabase=${runJdk} mod deps --curses=no; ${bazelForDeps}/bin/bazel --server_javabase=${runJdk} vendor src:bazel_nojdk \ --curses=no \ --vendor_dir ../vendor_dir \ --verbose_failures \ Loading Loading @@ -225,7 +237,16 @@ let ''; outputHashMode = "recursive"; outputHash = "sha256-GjktM25K4OPrww1o9jB38h0FwJrcJo7TR0x0owZV9I0="; outputHash = if stdenv.hostPlatform.system == "x86_64-linux" then "sha256-GjktM25K4OPrww1o9jB38h0FwJrcJo7TR0x0owZV9I0=" else if stdenv.hostPlatform.system == "aarch64-linux" then "sha256-T7vVWLlRzhaWneKMgMdgjUpBwRuGZ9ZFtD2AQvH9krI=" else if stdenv.hostPlatform.system == "aarch64-darwin" then "sha256-zv39lLMwfOr0MfK8dZ0alEwXpWdf97XEc6ciAoO4OK0=" else # x86_64-darwin lib.fakeSha256; outputHashAlgo = "sha256"; }; Loading Loading @@ -647,6 +668,7 @@ stdenv.mkDerivation rec { #!${runtimeShell} -e exit 1 EOF chmod +x tools/bazel # first call should fail if tools/bazel is used Loading Loading @@ -701,6 +723,6 @@ stdenv.mkDerivation rec { # tests = callPackage ./tests.nix { inherit Foundation bazelDeps bazel_self; }; # For ease of debugging inherit bazelDeps bazelFhs; inherit bazelDeps bazelFhs bazelBootstrap; }; }