-
Notifications
You must be signed in to change notification settings - Fork 0
/
shell.nix
36 lines (31 loc) · 990 Bytes
/
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
{ sources ? import ./sources.nix
, pkgs ? sources.pkgs
, jdk ? pkgs.openjdk11
, buildEnv ? pkgs.buildEnv
, buildSelf ? false }:
let
inherit (pkgs) callPackage mkShell;
inherit (pkgs.lib) optionals;
thisPackage = callPackage ./. {inherit pkgs jdk;};
thisPackageDeps =
thisPackage.buildInputs ++
thisPackage.propagatedBuildInputs ++
thisPackage.nativeBuildInputs ++
thisPackage.propagatedNativeBuildInputs;
envWithEverything = buildEnv {
name = "ibck-and-deps";
paths = thisPackageDeps;
};
in mkShell {
buildInputs = if buildSelf then
[thisPackage] ++ [envWithEverything]
else
thisPackageDeps ++ [envWithEverything];
# Create a link called `nix-jdk` that points to the JDK that was used.
# This allows us to use IntelliJ IDEA without worrying about breaking our project
# if we upgrade nixpkgs by specifying ./nix-jdk as the location of the JDK
shellHook = ''
rm -f ./nix-jdk
ln -s "${envWithEverything}" ./nix-jdk
'';
}