-
Notifications
You must be signed in to change notification settings - Fork 81
/
shell.nix
61 lines (54 loc) · 1.68 KB
/
shell.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{ pkgs ? import ./nixpkgs { }, docTools ? true, ghcVersion ? "9.4.6" }:
with pkgs;
let
macOS-security =
# make `/usr/bin/security` available in `PATH`, which is needed for stack
# on darwin which calls this binary to find certificates
writeScriptBin "security" ''exec /usr/bin/security "$@"'';
in
mkShell {
TMPDIR = "/tmp";
GHC_VERSION = ghcVersion;
# Set UTF-8 local so that run-tests can parse GHC's unicode output.
LANG = "C.UTF-8";
buildInputs = [
go
nix
which
perl
python3
jdk11
# For stack_install.
stack
# Needed for ghcide which expects ghc in PATH.
haskell.packages."ghc${ builtins.replaceStrings [ "." ] [ "" ] ghcVersion }".ghc
# Needed for @com_github_golang_protobuf, itself needed by buildifier.
git
# Needed to get correct locale for tests with encoding
glibcLocales
# to avoid CA certificate failures on macOS CI
cacert
# Needed for debug/linking_utils
binutils
# check the start script for problems
shellcheck
file
]
++ lib.optionals docTools [ graphviz python3Packages.sphinx zip unzip ]
++ lib.optional stdenv.isDarwin macOS-security;
packages = [ bazel_6 ];
shellHook = ''
# Add nix config flags to .bazelrc.local.
#
BAZELRC_LOCAL=".bazelrc.local"
if [ ! -e "$BAZELRC_LOCAL" ]
then
echo "[!] It looks like you are using a Nix-based system."
echo "In order to build this project, you need to add the two"
echo "following host_platform entries to your .bazelrc.local file:"
echo
echo "build --host_platform=@rules_nixpkgs_core//platforms:host"
echo "run --host_platform=@rules_nixpkgs_core//platforms:host"
fi
'';
}