-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
50 lines (47 loc) · 1.52 KB
/
flake.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
{
description = "Project Environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.05";
flake-utils.url = "github:numtide/flake-utils";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system: {
devShell = (
let
inherit system;
pkgs = nixpkgs.legacyPackages.${system};
bazel = pkgs.writeScriptBin "bazel" (''
#!${pkgs.bash}/bin/bash
# Set the JAVA_HOME to our JDK
export JAVA_HOME=${pkgs.jdk8.home}
export GIT_SSL_CAINFO="${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"
'' + pkgs.lib.optionalString (pkgs.buildPlatform.libc == "glibc") ''
export LOCALE_ARCHIVE="${pkgs.glibcLocales}/lib/locale/locale-archive"
'' + ''
exec ${pkgs.bazel_4}/bin/bazel "$@"
'');
in
pkgs.mkShell {
buildInputs = with pkgs; [
git
cacert
coreutils-full
toybox
curlFull
nixFlakes
bazel
];
shellHook = ''
# patch binary from toybox breaks some of bazel repository rules when running `bazel sync`
# override path to force use of gnupatch instead
export PATH="${pkgs.gnupatch}/bin:''${PATH}"
source ${pkgs.bash-completion}/etc/profile.d/bash_completion.sh
'';
}
);
});
}