File tree 3 files changed +33
-21
lines changed
3 files changed +33
-21
lines changed Original file line number Diff line number Diff line change 35
35
36
36
customStdenv = import ./tools/llvmStdenv.nix { inherit pkgs ; } ;
37
37
38
+ # TODO(aaronmondal): This doesn't work with rules_rust yet.
39
+ customClang = pkgs . callPackage ./tools/customClang.nix {
40
+ inherit pkgs ;
41
+ stdenv = customStdenv ;
42
+ } ;
43
+
38
44
craneLib = crane . lib . ${ system } ;
39
45
40
46
src = pkgs . lib . cleanSourceWith {
128
134
# Additional tools from within our development environment.
129
135
local-image-test
130
136
generate-toolchains
137
+ customClang
131
138
] ++ maybeDarwinDeps ;
132
139
shellHook = ''
133
140
# Generate the .pre-commit-config.yaml symlink when entering the
Original file line number Diff line number Diff line change 2
2
3
3
let
4
4
customStdenv = import ../tools/llvmStdenv.nix { inherit pkgs ; } ;
5
-
6
- # Bazel expects a single frontend for both C and C++. That works for GCC but
7
- # not for clang. This wrapper selects `clang` or `clang++` depending on file
8
- # ending.
9
- # TODO(aaronmondal): The necessity of this is a bug.
10
- # See: https://github.com/NixOS/nixpkgs/issues/216047
11
- # and https://github.com/NixOS/nixpkgs/issues/150655
12
- customClang = pkgs . writeShellScriptBin "customClang" ''
13
- #! ${ customStdenv . shell }
14
- function isCxx() {
15
- if [ $# -eq 0 ]; then false
16
- elif [ "$1" == '-xc++' ]; then true
17
- elif [[ -f "$1" && "$1" =~ [.](hh|H|hp|hxx|hpp|HPP|h[+]{2}|tcc|cc|cp|cxx|cpp|CPP|c[+]{2}|C)$ ]]; then true
18
- else isCxx "'' ${@:2}"; fi
19
- }
20
- if isCxx "$@"; then
21
- exec "${ customStdenv . cc } /bin/clang++" "$@"
22
- else
23
- exec "${ customStdenv . cc } /bin/clang" "$@"
24
- fi
25
- '' ;
5
+ customClang = pkgs . callPackage ../tools/customClang.nix {
6
+ inherit pkgs ;
7
+ stdenv = customStdenv ;
8
+ } ;
26
9
in
27
10
28
11
# TODO(aaronmondal): Bazel and a few other tools in this container are only
Original file line number Diff line number Diff line change
1
+ { pkgs , stdenv } :
2
+
3
+ # Bazel expects a single frontend for both C and C++. That works for GCC but
4
+ # not for clang. This wrapper selects `clang` or `clang++` depending on file
5
+ # ending.
6
+ # TODO(aaronmondal): The necessity of this is a bug.
7
+ # See: https://github.com/NixOS/nixpkgs/issues/216047
8
+ # and https://github.com/NixOS/nixpkgs/issues/150655
9
+ pkgs . writeShellScriptBin "customClang" ''
10
+ #! ${ stdenv . shell }
11
+ function isCxx() {
12
+ if [ $# -eq 0 ]; then false
13
+ elif [ "$1" == '-xc++' ]; then true
14
+ elif [[ -f "$1" && "$1" =~ [.](hh|H|hp|hxx|hpp|HPP|h[+]{2}|tcc|cc|cp|cxx|cpp|CPP|c[+]{2}|C)$ ]]; then true
15
+ else isCxx "'' ${@:2}"; fi
16
+ }
17
+ if isCxx "$@"; then
18
+ exec "${ stdenv . cc } /bin/clang++" "$@"
19
+ else
20
+ exec "${ stdenv . cc } /bin/clang" "$@"
21
+ fi
22
+ ''
You can’t perform that action at this time.
0 commit comments