forked from brendanhay/amazonka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
shell.nix
44 lines (36 loc) · 1.02 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
{ system ? builtins.currentSystem, ghcVersion ? "8107" }:
let
pkgs = import ./nix/nixpkgs.nix { inherit system; };
kernel = if pkgs.stdenv.targetPlatform.isLinux then
"linux"
else if pkgs.stdenv.targetPlatform.isDarwin then
"darwin"
else
throw "unsupported system";
bazelrc = pkgs.writeText "amazonka-ghc${ghcVersion}-bazelrc" ''
build --config=${kernel}
build --//tools/ghc:version=${ghcVersion}
'';
bazel = pkgs.writeScriptBin "bazel" ''
#!${pkgs.stdenvNoCC.shell}
export JAVA_HOME="${pkgs.jdk11_headless.home}"
exec ${pkgs.bazel_4}/bin/bazel --bazelrc="${bazelrc}" "$@"
'';
# Ensure zlib and friends are locatable if you use cabal in the nix-shell.
ghc = pkgs.haskell.packages."ghc${ghcVersion}".ghcWithPackages
(self: [ self.digest self.zlib ]);
in pkgs.mkShell {
buildInputs = [
bazel
ghc
pkgs.python3
pkgs.cabal-install
pkgs.haskellPackages.cabal-fmt
pkgs.curl
pkgs.ormolu
pkgs.nixfmt
pkgs.shfmt
pkgs.shellcheck
pkgs.parallel
];
}