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 3c5f802 commit fe1fd9e
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,6 +1,7 @@
{
pkgs,
ncurses5-fhs,
bazel_ot,
python_ot,
verilator_ot,
edaTools ? [],
Expand All @@ -13,8 +14,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) ncurses5-fhs verilator_ot python_ot;
inherit (packages) ncurses5-fhs 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 @@ -11,6 +11,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 fe1fd9e

Please sign in to comment.