intel-oneapi-toolkit: fold extendMkDerivation

This commit is contained in:
kilyanni
2026-05-18 17:37:58 +02:00
parent 6547eb519c
commit d1ff997cb3
+201 -220
View File
@@ -124,239 +124,220 @@ let
sed -i "s|hash = \".*\";|hash = \"$hash\";|" "$file"
'';
});
in
(lib.extendMkDerivation {
constructDrv = stdenv.mkDerivation;
excludeDrvArgNames = [
"depsByComponent"
"components"
# Figured out by looking at autoPatchelfHook failure output
depsByComponent = rec {
advisor = [
libdrm
zlib
gtk2
gdk-pixbuf
at-spi2-atk
glib
pango
gdk-pixbuf
cairo
fontconfig
glib
freetype
libx11
libxxf86vm
libxext
libxcb
libxcomposite
libxdamage
libxfixes
libxrandr
nss
dbus
cups
libgbm
expat
libxkbcommon
eudev
alsa-lib
ncurses5
bzip2
libuuid
gdbm
libxcrypt-legacy
sqlite
nspr
];
dpcpp-cpp-compiler = [
zlib
level-zero
];
dpcpp_dbg = [
level-zero
zlib
];
dpcpp-ct = [ zlib ];
mpi = [
zlib
rdma-core
libpsm2
ucx
libuuid
numactl
level-zero
libffi
];
pti = [ level-zero ];
vtune = [
libdrm
elfutils
zlib
libx11
libxext
libxcb
libxcomposite
libxdamage
libxfixes
libxrandr
glib
nss
dbus
at-spi2-atk
cups
gtk3
pango
cairo
libgbm
expat
libxkbcommon
eudev
alsa-lib
at-spi2-atk
ncurses5
bzip2
libuuid
gdbm
libxcrypt-legacy
sqlite
nspr
];
ifort-compiler = [ ];
tbb = [ ];
mkl = mpi ++ pti;
};
in
stdenv.mkDerivation (finalAttrs: {
pname = "intel-oneapi-toolkit";
versionYear = "2026";
versionMajor = "0";
versionMinor = "0";
versionRel = "198";
version = "${finalAttrs.versionYear}.${finalAttrs.versionMajor}.${finalAttrs.versionMinor}.${finalAttrs.versionRel}";
strictDeps = true;
__structuredAttrs = true;
src = fetchurl {
url = "https://registrationcenter-download.intel.com/akdlm/IRC_NAS/71180075-e4e3-4c6f-bbbb-19017ed0cf7d/intel-oneapi-toolkit-2026.0.0.198_offline.sh";
hash = "sha256-FVpSiWvSQjndxzP0h+zLKvXK2ZV+7R4r/mDOFFNpTls=";
};
nativeBuildInputs = [
ncurses5
bc
bubblewrap
autoPatchelfHook
writableTmpDirAsHomeHook
];
extendDrvArgs =
finalAttrs:
{
depsByComponent ? { },
components ? [ "default" ],
...
}:
{
version = "${finalAttrs.versionYear}.${finalAttrs.versionMajor}.${finalAttrs.versionMinor}.${finalAttrs.versionRel}";
buildInputs = [
python3
# Required for patchShebangs to discover the correct interpreter
bash
]
++ lib.concatMap (
comp:
if comp == "all" || comp == "default" then
lib.concatLists (builtins.attrValues depsByComponent)
else
depsByComponent.${shortName comp} or [ ]
) components;
strictDeps = true;
__structuredAttrs = true;
dontUnpack = true;
nativeBuildInputs = [
ncurses5
bc
bubblewrap
autoPatchelfHook
writableTmpDirAsHomeHook
];
# See https://software.intel.com/content/www/us/en/develop/documentation/installation-guide-for-intel-oneapi-toolkits-linux/top/installation/install-with-command-line.html
installPhase = ''
runHook preInstall
mkdir -p "$out"
buildInputs = [
python3
# Required for patchShebangs to discover the correct interpreter
bash
]
++ lib.concatMap (
comp:
if comp == "all" || comp == "default" then
lib.concatLists (builtins.attrValues depsByComponent)
else
depsByComponent.${shortName comp} or [ ]
) components;
export LD_LIBRARY_PATH="${lib.makeLibraryPath [ libgcc.lib ]}"
dontUnpack = true;
# The installer is an insane four-stage rube goldberg machine:
# 1. Our $src (bash script) unpacks install.sh (bash script)
# 2. install.sh unpacks bootstrapper (dylinked binary with hardcoded interpreter in /lib)
# 3. bootstrapper unpacks installer (dylinked binary with hardcoded interpreter and libraries in /lib)
# 4. installer installs the actual components we need
#
# While stage 1 allows to "only extract", other stages always try running the next executable down, and remove stuff if they fail.
# I'm afraid this is the cleanest solution for now.
mkdir -p fhs-root/{lib,lib64}
ln -s "${glibc}/lib/"* fhs-root/lib/
ln -s "${glibc}/lib/"* fhs-root/lib64/
bwrap \
--bind fhs-root / \
--bind /nix /nix \
--ro-bind /bin /bin \
--dev /dev \
--proc /proc \
bash "$src" \
-a \
--silent \
--eula accept \
--install-dir "$out" \
--components ${lib.concatStringsSep ":" components}
# See https://software.intel.com/content/www/us/en/develop/documentation/installation-guide-for-intel-oneapi-toolkits-linux/top/installation/install-with-command-line.html
installPhase = ''
runHook preInstall
mkdir -p "$out"
rm -rf "$out"/logs
rm -rf "$out"/.toolkit_linking_tool
export LD_LIBRARY_PATH="${lib.makeLibraryPath [ libgcc.lib ]}"
ln -s "$out/$versionYear.$versionMajor"/{lib,etc,bin,share,opt,include} "$out"
# The installer is an insane four-stage rube goldberg machine:
# 1. Our $src (bash script) unpacks install.sh (bash script)
# 2. install.sh unpacks bootstrapper (dylinked binary with hardcoded interpreter in /lib)
# 3. bootstrapper unpacks installer (dylinked binary with hardcoded interpreter and libraries in /lib)
# 4. installer installs the actual components we need
#
# While stage 1 allows to "only extract", other stages always try running the next executable down, and remove stuff if they fail.
# I'm afraid this is the cleanest solution for now.
mkdir -p fhs-root/{lib,lib64}
ln -s "${glibc}/lib/"* fhs-root/lib/
ln -s "${glibc}/lib/"* fhs-root/lib64/
bwrap \
--bind fhs-root / \
--bind /nix /nix \
--ro-bind /bin /bin \
--dev /dev \
--proc /proc \
bash "$src" \
-a \
--silent \
--eula accept \
--install-dir "$out" \
--components ${lib.concatStringsSep ":" components}
runHook postInstall
'';
rm -rf "$out"/logs
rm -rf "$out"/.toolkit_linking_tool
autoPatchelfIgnoreMissingDeps = [
# Needs to be dynamically loaded as it depends on the hardware
"libcuda.so.1"
# All too old, not in nixpkgs anymore
"libffi.so.6"
"libgdbm.so.4"
"libreadline.so.6"
# Bundled only as unversioned .so in GTPin; the .so.14 soname isn't present
"libopencl-clang.so.14"
# 2026 ships libsycl.so.9; some vtune binaries still reference the old .so.8
"libsycl.so.8"
# GTPin internal, not present in the package
"liboutputgenerator.so"
];
ln -s "$out/$versionYear.$versionMajor"/{lib,etc,bin,share,opt,include} "$out"
passthru.updateScript = mkUpdateScript {
inherit (finalAttrs) pname;
file = "package.nix";
downloadPage = "https://www.intel.com/content/www/us/en/developer/tools/oneapi/oneapi-toolkit-download.html";
};
runHook postInstall
'';
};
})
(finalAttrs: {
pname = "intel-oneapi-toolkit";
passthru.stdenv = callPackage ./stdenv.nix { kit = finalAttrs.finalPackage; };
src = fetchurl {
url = "https://registrationcenter-download.intel.com/akdlm/IRC_NAS/71180075-e4e3-4c6f-bbbb-19017ed0cf7d/intel-oneapi-toolkit-2026.0.0.198_offline.sh";
hash = "sha256-FVpSiWvSQjndxzP0h+zLKvXK2ZV+7R4r/mDOFFNpTls=";
};
passthru.tests = callPackage ./tests.nix { kit = finalAttrs.finalPackage; };
versionYear = "2026";
versionMajor = "0";
versionMinor = "0";
versionRel = "198";
inherit components;
# Figured out by looking at autoPatchelfHook failure output
depsByComponent = rec {
advisor = [
libdrm
zlib
gtk2
gdk-pixbuf
at-spi2-atk
glib
pango
gdk-pixbuf
cairo
fontconfig
glib
freetype
libx11
libxxf86vm
libxext
libxcb
libxcomposite
libxdamage
libxfixes
libxrandr
nss
dbus
cups
libgbm
expat
libxkbcommon
eudev
alsa-lib
ncurses5
bzip2
libuuid
gdbm
libxcrypt-legacy
sqlite
nspr
];
dpcpp-cpp-compiler = [
zlib
level-zero
];
dpcpp_dbg = [
level-zero
zlib
];
dpcpp-ct = [ zlib ];
mpi = [
zlib
rdma-core
libpsm2
ucx
libuuid
numactl
level-zero
libffi
];
pti = [ level-zero ];
vtune = [
libdrm
elfutils
zlib
libx11
libxext
libxcb
libxcomposite
libxdamage
libxfixes
libxrandr
glib
nss
dbus
at-spi2-atk
cups
gtk3
pango
cairo
libgbm
expat
libxkbcommon
eudev
alsa-lib
at-spi2-atk
ncurses5
bzip2
libuuid
gdbm
libxcrypt-legacy
sqlite
nspr
];
ifort-compiler = [ ];
tbb = [ ];
mkl = mpi ++ pti;
};
autoPatchelfIgnoreMissingDeps = [
# Needs to be dynamically loaded as it depends on the hardware
"libcuda.so.1"
# All too old, not in nixpkgs anymore
"libffi.so.6"
"libgdbm.so.4"
"libreadline.so.6"
# Bundled only as unversioned .so in GTPin; the .so.14 soname isn't present
"libopencl-clang.so.14"
# 2026 ships libsycl.so.9; some vtune binaries still reference the old .so.8
"libsycl.so.8"
# GTPin internal, not present in the package
"liboutputgenerator.so"
meta = {
description = "Intel oneAPI Toolkit";
homepage = "https://www.intel.com/content/www/us/en/developer/tools/oneapi/oneapi-toolkit.html";
license = with lib.licenses; [
intel-eula
issl
asl20
];
passthru.updateScript = mkUpdateScript {
inherit (finalAttrs) pname;
file = "package.nix";
downloadPage = "https://www.intel.com/content/www/us/en/developer/tools/oneapi/oneapi-toolkit-download.html";
};
passthru.stdenv = callPackage ./stdenv.nix { kit = finalAttrs.finalPackage; };
passthru.tests = callPackage ./tests.nix { kit = finalAttrs.finalPackage; };
meta = {
description = "Intel oneAPI Toolkit";
homepage = "https://www.intel.com/content/www/us/en/developer/tools/oneapi/oneapi-toolkit.html";
license = with lib.licenses; [
intel-eula
issl
asl20
];
maintainers = with lib.maintainers; [
balsoft
];
platforms = [ "x86_64-linux" ];
};
})
maintainers = with lib.maintainers; [
balsoft
];
platforms = [ "x86_64-linux" ];
};
})