Skip to content

Commit

Permalink
Introduce bazel_ot package
Browse files Browse the repository at this point in the history
This is bazelisk with auto completion stolen from bazel package.
  • Loading branch information
nbdd0121 committed Jan 3, 2024
1 parent b51a04d commit 28cc6a6
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
4 changes: 2 additions & 2 deletions dev/opentitan.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
pkgs,
bazel_ot,
python_ot,
verilator_ot,
ncurses5,
Expand Down Expand Up @@ -29,8 +30,7 @@ in
targetPkgs = _:
with pkgs;
[
bazelisk

bazel_ot
python_ot
verilator_ot

Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
packages = import ./pkgs {inherit pkgs inputs;};
devShells = {
opentitan = pkgs.callPackage ./dev/opentitan.nix {
inherit (packages) verilator_ot python_ot;
inherit (packages) bazel_ot verilator_ot python_ot;
};
};
formatter = pkgs.alejandra;
Expand Down
20 changes: 20 additions & 0 deletions pkgs/bazel_ot/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
runCommand,
bazelisk,
bazel_6,
...
}:
# OpenTitan requires a specific version of Bazel.
# We *could* package our own Bazel, but it can't be a simple override since Bazel build process
# require a lot of Internet dependencies.
#
# For simplicity we'll just let bazelisk do the heavyloading.
#
# This package basically just creates an alias from bazel to bazelisk and adds the auto completion
# which is absent in bazelisk.
runCommand "bazel" {} ''
cp -r ${bazelisk} $out
chmod -R +w $out
ln -s $out/bin/bazelisk $out/bin/bazel
cp -r ${bazel_6}/share $out/share
''
1 change: 1 addition & 0 deletions pkgs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
{
verilator_ot = import ./verilator {inherit pkgs;};
python_ot = pkgs.callPackage ./python_ot {inherit inputs;};
bazel_ot = pkgs.callPackage ./bazel_ot {};
}
// pkgs.lib.optionalAttrs (pkgs.system == "x86_64-linux") {
lowrisc-toolchain-gcc-rv32imcb = pkgs.callPackage ./lowrisc-toolchain-gcc-rv32imcb.nix {};
Expand Down

0 comments on commit 28cc6a6

Please sign in to comment.