-
Notifications
You must be signed in to change notification settings - Fork 0
/
mathematica.nix
256 lines (189 loc) · 6.51 KB
/
mathematica.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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
with import <nixpkgs> {};
let fhs = pkgs.buildFHSUserEnv {
name = "mathematica_install_start";
targetPkgs = pkgs: (with pkgs;
[
gtk2 gtk3 webkitgtk gdk-pixbuf cairo pango
atk
perl
# libselinux
lsb-release
udev
coreutils
patchelf
alsaLib
coreutils
dbus
fontconfig
freetype
gcc.cc
gcc.libc
glib
ncurses
opencv
openssl
unixODBC
xkeyboard_config
libxml2
libuuid
zlib
libGL
libGLU
]) ++ (with pkgs.xorg;
[
libX11
libXext
libXtst
libXi
libXmu
libXrender
libxcb
libXcursor
libXfixes
libXrandr
libICE
libSM
libXdamage
libXcomposite
libXScrnSaver
libXt
libXxf86vm
autoPatchelfHook
]);
runScript = "bash"; # 安装时用
profile = ''
export PATH=$PATH:$HOME/.local/bin
export MATLABROOT=/ah/prehonor/Programmers/MATLAB/R2021b
'';
};
in pkgs.stdenv.mkDerivation {
name = "matlab_with_clion";
python = python3.withPackages(ps: with ps; [ pip urllib3 pytorch-bin torchvision-bin pyside2 ]); # pytorchWithoutCuda
public_libs = [
libGL gnome2.GConf
linuxPackages.nvidia_x11 cudaPackages.cudatoolkit_11 cudnn_cudatoolkit_11_2 nccl_cudatoolkit_11
];
rizin_libs = [
file
libzip
capstone
readline
libusb-compat-0_1
libewf
perl
zlib
lz4
openssl
libuv
tree-sitter
xxHash
];
okular_b_nb = [
breeze-icons discount djvulibre ebook_tools
libsForQt5.kactivities libsForQt5.karchive libsForQt5.kbookmarks
libsForQt5.kcompletion libsForQt5.kconfig libsForQt5.kconfigwidgets libsForQt5.kcoreaddons libsForQt5.kdbusaddons libsForQt5.kdegraphics-mobipocket libsForQt5.kiconthemes libsForQt5.kjs libsForQt5.khtml libsForQt5.kio libsForQt5.kparts libsForQt5.kpty libsForQt5.kpurpose libsForQt5.kwallet
libsForQt5.kwindowsystem libsForQt5.libkexiv2 libspectre libzip libsForQt5.phonon libsForQt5.poppler libsForQt5.qca-qt5 libsForQt5.qt5.qtdeclarative libsForQt5.qt5.qtsvg libsForQt5.threadweaver libsForQt5.kcrash
];
buildInputs = [
python
autoPatchelfHook
bash
curl
qtcreator
# jetbrains.webstorm jetbrains.idea-ultimate jetbrains.clion
qt5.full
jdk
boost_x liburing gmock libmysqlclient libmysqlconnectorcpp
openssl.dev
mysql80
ocrmypdf
libxml2 libxslt openssl
# 编译openjdk必须的环镜
xorg.libICE xorg.libXrender xorg.libXtst xorg.libXt
xorg.libXinerama xorg.libXcursor
xorg.libXi xorg.libXmu freeglut
xorg.libXext xorg.libX11 xorg.libXv xorg.libXrandr
ncurses5 stdenv.cc binutils # gnumake gitFull # git gitRepo
cups fontconfig alsaLib libjpeg giflib libpng lcms2
gnupg
procps utillinux m4 gperf unzip
webkitgtk gdk-pixbuf libdrm mesa gtk3
gnome2.gnome_vfs
libglvnd cairo pango
libsodium
libcap # golang
graphviz
libsForQt5.syntax-highlighting
libsForQt5.qt5.qtdeclarative
] ++ public_libs ++ rizin_libs;
nativeBuild_okular = [
extra-cmake-modules libsForQt5.kdoctools
] ++ okular_b_nb;
libs = with xorg; [
alsaLib atk cups dbus expat gdk-pixbuf glib gtk2
# fontconfig libXtst libXext libXi libXrandr libX11 libXcursor mesa libdrm
libxcb libXcomposite libXdamage libXfixes
libXrender libXScrnSaver nspr nss libpulseaudio
systemd at-spi2-core at-spi2-atk zlib
] ++ public_libs ++ okular_b_nb;
nativeBuildInputs = [
pkg-config cmake ninja rustup autoconf meson
python
clang_x
# llvm_x lld_x lldb_x clang_x libclang_x # gcc gdb
] ++ nativeBuild_okular ++ [ fhs ];
ld = lib.makeLibraryPath ([
stdenv.cc.cc.lib glibc # fontconfig.lib python38Packages.pytorch-bin
] ++ libs);
GOROOT = "${pkgs.go.out}/share/go";
CFLAGS="-I${pkgs.glibc.dev}/include";
hardeningDisable = [ "all" ]; # 为了解决cgo warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp]
LDFLAGS="-L${pkgs.glibc}/lib";
shellHook = ''
export ANDROID_HOME="/gh/prehonor/Android/Sdk"
export MAVEN_OPTS='-Xms300m -Xmx300m'
export JAVA_CPPFLAGS=-I${jdk}/include/
export JAVA_HOME=${jdk.home}
export ANT_HOME="/ah/prehonor/Programmers/apache-ant-1.10.8"
export CARGO_HOME="$HOME/.cargo/"
export RUSTUP_DIST_SERVER=http://mirrors.ustc.edu.cn/rust-static
export RUSTUP_UPDATE_ROOT=http://mirrors.ustc.edu.cn/rust-static/rustup
export RUST_SRC_PATH="$(rustc --print sysroot)/lib/rustlib/src/rust/src"
export PATH=$PATH:"$(rustc --print sysroot)/bin/":"$CARGO_HOME/bin":"$HOME/.local/bin":"$HOME/.local/usr/bin":"/ah/prehonor/.npm/bin:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/emulator:/gh/prehonor/gitproject/wasmtime/target/debug:/gh/prehonor/gitproject/vcpkg"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${ld}:/home/prehonor/Public/test:${cudaPackages.cudatoolkit_11}/lib
export LIBCLANG_PATH="${libclang_x.lib}/lib"
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/home/prehonor/.local/usr/lib/pkgconfig
# idea 调试 rust 会下载本地调试插件和lldb调试器 ,需要patchelf
# export LD_LIBRARY_PATH=/home/prehonor/.cache/JetBrains/IntelliJIdea2021.2/intellij-rust/lldb/lib::$LD_LIBRARY_PATH
# autoPatchelf /home/prehonor/.cache/JetBrains/IntelliJIdea2021.2/intellij-rust/lldb/bin
# autoPatchelf /ah/prehonor/.npm
export CUDA_HOME=${cudaPackages.cudatoolkit_11}
export CUDA_PATH=${cudaPackages.cudatoolkit_11}
export EXTRA_LDFLAGS="-L/lib -L${pkgs.linuxPackages.nvidia_x11}/lib"
export EXTRA_CCFLAGS="-I/usr/include"
export PYTHON_LIBRARY=${python}/lib
export PYTHON_INCLUDE_DIRS=${python}/include/python3.8
export NCCL_ROOT=${nccl_cudatoolkit_11.dev}
export CUDNN_ROOT=${cudnn_cudatoolkit_11_2}
# export PIP_PREFIX=/home/prehonor/.local/pythonEnvs/pip_packages
# export PYTHONPATH="$PIP_PREFIX/${python.sitePackages}:$PYTHONPATH"
# export PATH="$PIP_PREFIX/bin:$PATH"
# unset SOURCE_DATE_EPOCH
export GOROOT=${GOROOT}
export GOPATH="$HOME/go"
export GOPROXY="https://mirrors.aliyun.com/goproxy/"
unset http_proxy
unset https_proxy
unset ftp_proxy
unset all_proxy
source /home/prehonor/.local/pythonEnvs/foo/bin/activate
LIBRARY_PATH=""
for b in ${toString (map lib.getLib rizin_libs)}; do
if [[ -d "$b/lib" ]]; then
LIBRARY_PATH="$b/lib''${LIBRARY_PATH:+:}$LIBRARY_PATH"
fi
done
export LIBRARY_PATH
exec mathematica_install_start
'';
}