Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 22 additions & 20 deletions nix/bazel.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{ pkgs, clang, cuda }:
let
{
pkgs,
clang,
cuda,
}: let
# Set PATH so that it only includes things bazel needs.
path = pkgs.lib.strings.concatStringsSep ":" [
"${clang}/bin"
Expand All @@ -16,21 +19,20 @@ let
];
bazel = "${pkgs.bazel_7}/bin/bazel";
in
pkgs.writeShellScriptBin "bazel" ''
if [[
"$1" == "build" ||
"$1" == "test" ||
"$1" == "run"
]]; then
exec ${bazel} $1 \
--action_env CC=${clang}/bin/clang \
--action_env CXX=${clang}/bin/clang++ \
--action_env PATH="${path}" \
--action_env CUDA_PATH="${cuda}" \
--action_env=BAZEL_LINKLIBS='-l%:libc++.a' \
--action_env=BAZEL_LINKOPTS='-L${clang}/lib' \
''${@:2}
else
exec ${bazel} $@
fi''

pkgs.writeShellScriptBin "bazel" ''
if [[
"$1" == "build" ||
"$1" == "test" ||
"$1" == "run"
]]; then
exec ${bazel} $1 \
--action_env CC=${clang}/bin/clang \
--action_env CXX=${clang}/bin/clang++ \
--action_env PATH="${path}" \
--action_env CUDA_PATH="${cuda}" \
--action_env=BAZEL_LINKLIBS='-l%:libc++.a' \
--action_env=BAZEL_LINKOPTS='-L${clang}/lib' \
''${@:2}
else
exec ${bazel} $@
fi''
Loading