From fe1fd9e9d18b1eaf64d46e0765a2f6ee6aaa9026 Mon Sep 17 00:00:00 2001 From: Gary Guo Date: Wed, 3 Jan 2024 17:15:13 +0000 Subject: [PATCH] Introduce bazel_ot package This is bazelisk with auto completion stolen from bazel package. --- dev/opentitan.nix | 4 ++-- flake.nix | 2 +- pkgs/bazel_ot/default.nix | 20 ++++++++++++++++++++ pkgs/default.nix | 1 + 4 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 pkgs/bazel_ot/default.nix diff --git a/dev/opentitan.nix b/dev/opentitan.nix index 197aa9b..8b4e63b 100644 --- a/dev/opentitan.nix +++ b/dev/opentitan.nix @@ -1,6 +1,7 @@ { pkgs, ncurses5-fhs, + bazel_ot, python_ot, verilator_ot, edaTools ? [], @@ -13,8 +14,7 @@ in targetPkgs = _: with pkgs; [ - bazelisk - + bazel_ot python_ot verilator_ot diff --git a/flake.nix b/flake.nix index 63c7402..0416e23 100644 --- a/flake.nix +++ b/flake.nix @@ -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; diff --git a/pkgs/bazel_ot/default.nix b/pkgs/bazel_ot/default.nix new file mode 100644 index 0000000..f7ea11b --- /dev/null +++ b/pkgs/bazel_ot/default.nix @@ -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 +'' diff --git a/pkgs/default.nix b/pkgs/default.nix index 21ecba4..36858bd 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -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 {};