|
| 1 | +{ pkgs ? import ./nixpkgs { }, docTools ? true, ghcVersion ? "9.2.8" }: |
| 2 | + |
| 3 | +with pkgs; |
| 4 | +mkShell { |
| 5 | + # XXX: hack for macosX, this flags disable bazel usage of xcode |
| 6 | + # Note: this is set even for linux so any regression introduced by this flag |
| 7 | + # will be catched earlier |
| 8 | + # See: https://github.com/bazelbuild/bazel/issues/4231 |
| 9 | + BAZEL_USE_CPP_ONLY_TOOLCHAIN = 1; |
| 10 | + TMPDIR = "/tmp"; |
| 11 | + |
| 12 | + GHC_VERSION = ghcVersion; |
| 13 | + |
| 14 | + # Set UTF-8 local so that run-tests can parse GHC's unicode output. |
| 15 | + LANG = "C.UTF-8"; |
| 16 | + |
| 17 | + buildInputs = [ |
| 18 | + go |
| 19 | + nix |
| 20 | + which |
| 21 | + perl |
| 22 | + python3 |
| 23 | + jdk11 |
| 24 | + # For stack_install. |
| 25 | + stack |
| 26 | + # Needed for ghcide which expects ghc in PATH. |
| 27 | + haskell.packages."ghc${ builtins.replaceStrings [ "." ] [ "" ] ghcVersion }".ghc |
| 28 | + # Needed for @com_github_golang_protobuf, itself needed by buildifier. |
| 29 | + git |
| 30 | + # Needed to get correct locale for tests with encoding |
| 31 | + glibcLocales |
| 32 | + # to avoid CA certificate failures on macOS CI |
| 33 | + cacert |
| 34 | + # Needed for debug/linking_utils |
| 35 | + binutils |
| 36 | + # check the start script for problems |
| 37 | + shellcheck |
| 38 | + file |
| 39 | + ] ++ lib.optionals docTools [ graphviz python39Packages.sphinx zip unzip ]; |
| 40 | + |
| 41 | + packages = [ bazel_6 ]; |
| 42 | + |
| 43 | + shellHook = '' |
| 44 | + # Add nix config flags to .bazelrc.local. |
| 45 | + # |
| 46 | + BAZELRC_LOCAL=".bazelrc.local" |
| 47 | + if [ ! -e "$BAZELRC_LOCAL" ] |
| 48 | + then |
| 49 | + echo "[!] It looks like you are using a Nix-based system." |
| 50 | + echo "In order to build this project, you need to add the two" |
| 51 | + echo "following host_platform entries to your .bazelrc.local file:" |
| 52 | + echo |
| 53 | + echo "build --host_platform=@rules_nixpkgs_core//platforms:host" |
| 54 | + echo "run --host_platform=@rules_nixpkgs_core//platforms:host" |
| 55 | + fi |
| 56 | + ''; |
| 57 | +} |
0 commit comments