nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 fetchurl,
4 zlib,
5 rdma-core,
6 libpsm2,
7 ucx,
8 numactl,
9 level-zero,
10 pkg-config,
11 libdrm,
12 elfutils,
13 libxxf86vm,
14 libxrandr,
15 libxfixes,
16 libxext,
17 libxdamage,
18 libxcomposite,
19 libx11,
20 libxcb,
21 glib,
22 nss,
23 nspr,
24 dbus,
25 at-spi2-atk,
26 cups,
27 gtk3,
28 pango,
29 cairo,
30 expat,
31 libxkbcommon,
32 eudev,
33 alsa-lib,
34 ncurses5,
35 bzip2,
36 gdbm,
37 libxcrypt-legacy,
38 freetype,
39 gtk2,
40 gdk-pixbuf,
41 fontconfig,
42 libuuid,
43 sqlite,
44
45 # The list of components to install;
46 # Either [ "all" ], [ "default" ], or a custom list of components.
47 # If you want to install all default components plus an extra one, pass [ "default" <your extra components here> ]
48 # Note that changing this will also change the `buildInputs` of the derivation.
49 # The default value is not "default" because some of the components in the defualt set are currently broken.
50 components ? [
51 "intel.oneapi.lin.advisor"
52 "intel.oneapi.lin.dpcpp-cpp-compiler"
53 "intel.oneapi.lin.dpcpp_dbg"
54 "intel.oneapi.lin.vtune"
55 "intel.oneapi.lin.mkl.devel"
56 ],
57
58 intel-oneapi,
59
60 # For tests
61 runCommand,
62 libffi,
63 stdenv,
64}:
65intel-oneapi.mkIntelOneApi (finalAttrs: {
66 pname = "intel-oneapi-base-toolkit";
67
68 src = fetchurl {
69 url = "https://registrationcenter-download.intel.com/akdlm/IRC_NAS/3b7a16b3-a7b0-460f-be16-de0d64fa6b1e/intel-oneapi-base-toolkit-2025.2.1.44_offline.sh";
70 hash = "sha256-oVURJZG6uZ3YvYefUuqeakbaVR47ZgWduBV6bS6r5Dk=";
71 };
72
73 versionYear = "2025";
74 versionMajor = "2";
75 versionMinor = "1";
76 versionRel = "44";
77
78 inherit components;
79
80 # Figured out by looking at autoPatchelfHook failure output
81 depsByComponent = rec {
82 advisor = [
83 libdrm
84 zlib
85 gtk2
86 gdk-pixbuf
87 at-spi2-atk
88 glib
89 pango
90 gdk-pixbuf
91 cairo
92 fontconfig
93 glib
94 freetype
95 libx11
96 libxxf86vm
97 libxext
98 libxcb
99 libxcomposite
100 libxdamage
101 libxfixes
102 libxrandr
103 nss
104 dbus
105 cups
106 expat
107 libxkbcommon
108 eudev
109 alsa-lib
110 ncurses5
111 bzip2
112 libuuid
113 gdbm
114 libxcrypt-legacy
115 sqlite
116 nspr
117 ];
118 dpcpp-cpp-compiler = [
119 zlib
120 level-zero
121 ];
122 dpcpp_dbg = [
123 level-zero
124 zlib
125 ];
126 dpcpp-ct = [ zlib ];
127 mpi = [
128 zlib
129 rdma-core
130 libpsm2
131 ucx
132 libuuid
133 numactl
134 level-zero
135 libffi
136 ];
137 pti = [ level-zero ];
138 vtune = [
139 libdrm
140 elfutils
141 zlib
142 libx11
143 libxext
144 libxcb
145 libxcomposite
146 libxdamage
147 libxfixes
148 libxrandr
149 glib
150 nss
151 dbus
152 at-spi2-atk
153 cups
154 gtk3
155 pango
156 cairo
157 expat
158 libxkbcommon
159 eudev
160 alsa-lib
161 at-spi2-atk
162 ncurses5
163 bzip2
164 libuuid
165 gdbm
166 libxcrypt-legacy
167 sqlite
168 nspr
169 ];
170 mkl = mpi ++ pti;
171 };
172
173 autoPatchelfIgnoreMissingDeps = [
174 # Needs to be dynamically loaded as it depends on the hardware
175 "libcuda.so.1"
176 # All too old, not in nixpkgs anymore
177 "libffi.so.6"
178 "libgdbm.so.4"
179 "libopencl-clang.so.14"
180 ];
181
182 passthru.updateScript = intel-oneapi.mkUpdateScript {
183 inherit (finalAttrs) pname;
184 file = "base.nix";
185 downloadPage = "https://www.intel.com/content/www/us/en/developer/tools/oneapi/base-toolkit-download.html?packages=oneapi-toolkit&oneapi-toolkit-os=linux&oneapi-lin=offline";
186 };
187
188 passthru.tests = {
189 mkl-libs = stdenv.mkDerivation {
190 name = "intel-oneapi-test-mkl-libs";
191 unpackPhase = ''
192 cp ${./test.c} test.c
193 '';
194
195 nativeBuildInputs = [
196 pkg-config
197 ];
198 buildInputs = [ intel-oneapi.base ];
199
200 buildPhase = ''
201 # This will fail if no libs with mkl- in their name are found
202 libs="$(pkg-config --list-all | cut -d\ -f1 | grep mkl-)"
203 for lib in $libs; do
204 echo "Testing that the build succeeds with $lib" >&2
205 gcc test.c -o test-with-$lib $(pkg-config --cflags --libs $lib)
206 done
207 '';
208
209 doCheck = true;
210
211 checkPhase = ''
212 for lib in $libs; do
213 echo "Testing that the executable built with $lib runs" >&2
214 ./test-with-$lib
215 done
216 '';
217
218 installPhase = ''
219 touch "$out"
220 '';
221 };
222
223 all-binaries-run = runCommand "intel-oneapi-test-all-binaries-run" { } ''
224 # .*-32: 32-bit executables can't be properly patched by patchelf
225 # IMB-.*: all fail with a weird "bad file descriptor" error
226 # fi_info, fi_pingpong: exits with 1 even if ran with `--help`
227 # gdb-openapi: Python not initialized
228 # hydra_bstrap_proxy, hydra_nameserver, hydra_pmi_proxy: doesn't respect --help
229 # mpirun: can't find mpiexec.hydra for some reason
230 # sycl-ls, sycl-trace: doesn't respect --help
231 regex_skip="(.*-32)|(IMB-.*)|fi_info|fi_pingpong|gdb-oneapi|hydra_bstrap_proxy|hydra_nameserver|hydra_pmi_proxy|mpirun|sycl-ls|sycl-trace"
232 export I_MPI_ROOT="${intel-oneapi.base}/mpi/latest"
233 for bin in "${intel-oneapi.base}"/bin/*; do
234 if [[ "$bin" =~ $regex_skip ]] || [ ! -f "$bin" ] || [[ ! -x "$bin" ]]; then
235 echo "skipping $bin"
236 continue
237 fi
238 echo "trying to run $bin --help or -help"
239 "$bin" --help || "$bin" -help
240 done
241 touch "$out"
242 '';
243 };
244
245 meta = {
246 description = "Intel oneAPI Base Toolkit";
247 homepage = "https://software.intel.com/content/www/us/en/develop/tools/oneapi/base-toolkit.html";
248 license = with lib.licenses; [
249 intel-eula
250 issl
251 asl20
252 ];
253 maintainers = with lib.maintainers; [
254 balsoft
255 ];
256 platforms = [ "x86_64-linux" ];
257 };
258})