-
Notifications
You must be signed in to change notification settings - Fork 1
/
shell.nix
121 lines (97 loc) · 2.58 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
{ compiler ? "gcc", mkl ? false, cuda ? false, docs ? true
, openmpi-version ? "3.1.0" }:
let
pkgs = import <nixpkgs> {
config.allowUnfree = true;
overlays = [ (import ./etc/nix/overlays/openmpi.nix openmpi-version) ];
};
# unfree-pkgs = import <nixpkgs> { config.allowUnfree = true; };
ctf = pkgs.callPackage ./etc/nix/ctf.nix { };
openblas = import ./etc/nix/openblas.nix { inherit pkgs; };
vendor = import ./etc/nix/vendor-shell.nix;
mkl-pkg = import ./etc/nix/mkl.nix { inherit pkgs; };
cuda-pkg = if cuda then (import ./cuda.nix { inherit pkgs; }) else { };
aatrip = import ./etc/nix/default.nix { inherit pkgs; };
in pkgs.mkShell rec {
compiler-pkg = if compiler == "gcc11" then
pkgs.gcc11
else if compiler == "gcc10" then
pkgs.gcc10
else if compiler == "gcc9" then
pkgs.gcc9
else if compiler == "gcc8" then
pkgs.gcc8
else if compiler == "gcc7" then
pkgs.gcc7
else if compiler == "gcc6" then
pkgs.gcc6
else if compiler == "gcc49" then
pkgs.gcc49
else if compiler == "clang13" then
pkgs.clang_13
else if compiler == "clang12" then
pkgs.clang_12
else if compiler == "clang11" then
pkgs.clang_11
else if compiler == "clang10" then
pkgs.clang_10
else if compiler == "clang9" then
pkgs.clang_9
else if compiler == "clang8" then
pkgs.clang_8
else if compiler == "clang7" then
pkgs.clang_7
else if compiler == "clang6" then
pkgs.clang_6
else if compiler == "clang5" then
pkgs.clang_5
else
pkgs.gcc;
docInputs = with pkgs; [
emacs
emacsPackages.ox-rst
emacsPackages.htmlize
python3
python3Packages.breathe
doxygen
sphinx
graphviz
];
buildInputs = with pkgs;
[
gdb
coreutils
git
vim
clang-tools
bear
openmpi
llvmPackages.openmp
binutils
gfortran
ctf
gnumake
libtool
autoconf
automake
pkg-config
] ++ (if mkl then mkl-pkg.buildInputs else openblas.buildInputs)
++ (if docs then docInputs else [ ]);
NIX_CTF = ctf;
CXX = "${compiler-pkg}/bin/c++";
CC = "${compiler-pkg}/bin/cc";
LD = "${compiler-pkg}/bin/ld";
shellHook = ''
${vendor.src}
${vendor.cpath "${pkgs.openmpi.out}/include"}
${vendor.cpath "${openblas.pkg.dev}/include"}
${vendor.lib "${pkgs.openmpi.out}/lib"}
${vendor.lib "${openblas.pkg.out}/lib"}
export OMPI_CXX=${CXX}
export OMPI_CC=${CC}
CXX=${CXX}
CC=${CC}
LD=${LD}
'' + (if mkl then mkl-pkg.shellHook else openblas.shellHook)
+ (if cuda then cuda-pkg.shellHook else "");
}