From 947f79b2cc9e55c4e1f7be28cd968aa81bbff25a Mon Sep 17 00:00:00 2001 From: Alexander Bantyev Date: Sun, 12 Oct 2025 17:40:58 +0400 Subject: [PATCH] fixup! intel-oneapi.{base,hpc}: init at 2025.2.1.44 --- pkgs/by-name/in/intel-oneapi/base.nix | 14 +-- pkgs/by-name/in/intel-oneapi/hpc.nix | 10 +-- pkgs/by-name/in/intel-oneapi/package.nix | 105 ++++++++++++----------- pkgs/by-name/in/intel-oneapi/test.c | 12 +++ 4 files changed, 81 insertions(+), 60 deletions(-) create mode 100644 pkgs/by-name/in/intel-oneapi/test.c diff --git a/pkgs/by-name/in/intel-oneapi/base.nix b/pkgs/by-name/in/intel-oneapi/base.nix index 185b77127d8c..749009ad48b7 100644 --- a/pkgs/by-name/in/intel-oneapi/base.nix +++ b/pkgs/by-name/in/intel-oneapi/base.nix @@ -56,12 +56,12 @@ libffi, stdenv, }: -intel-oneapi.mkIntelOneApi rec { +intel-oneapi.mkIntelOneApi (fa: { pname = "intel-oneapi-base-toolkit"; src = fetchurl { url = "https://registrationcenter-download.intel.com/akdlm/IRC_NAS/3b7a16b3-a7b0-460f-be16-de0d64fa6b1e/intel-oneapi-base-toolkit-2025.2.1.44_offline.sh"; - sha256 = "0fg4mcp6syhmp2fhariv3raxlikakvm557w7ppc9vfdsj4ji2md1"; + hash = "sha256-oVURJZG6uZ3YvYefUuqeakbaVR47ZgWduBV6bS6r5Dk="; }; versionYear = "2025"; @@ -176,7 +176,7 @@ intel-oneapi.mkIntelOneApi rec { ]; passthru.updateScript = intel-oneapi.mkUpdateScript { - inherit pname; + inherit (fa) pname; file = "base.nix"; 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"; }; @@ -191,7 +191,7 @@ intel-oneapi.mkIntelOneApi rec { nativeBuildInputs = [ pkg-config ]; - buildInputs = [ intel-oneapi ]; + buildInputs = [ intel-oneapi.base ]; buildPhase = '' # This will fail if no libs with mkl- in their name are found @@ -225,7 +225,7 @@ intel-oneapi.mkIntelOneApi rec { # mpirun: can't find mpiexec.hydra for some reason # sycl-ls, sycl-trace: doesn't respect --help regex_skip="(.*-32)|(IMB-.*)|fi_info|fi_pingpong|gdb-oneapi|hydra_bstrap_proxy|hydra_nameserver|hydra_pmi_proxy|mpirun|sycl-ls|sycl-trace" - export I_MPI_ROOT="${intel-oneapi}/mpi/latest" + export I_MPI_ROOT="${intel-oneapi.base}/mpi/latest" for bin in "${intel-oneapi}"/bin/*; do if [[ "$bin" =~ $regex_skip ]] || [ ! -f "$bin" ] || [[ ! -x "$bin" ]]; then echo "skipping $bin" @@ -238,7 +238,7 @@ intel-oneapi.mkIntelOneApi rec { ''; }; - meta = with lib; { + meta = { description = "Intel oneAPI Base Toolkit"; homepage = "https://software.intel.com/content/www/us/en/develop/tools/oneapi/base-toolkit.html"; license = with lib.licenses; [ @@ -251,4 +251,4 @@ intel-oneapi.mkIntelOneApi rec { ]; platforms = [ "x86_64-linux" ]; }; -} +}) diff --git a/pkgs/by-name/in/intel-oneapi/hpc.nix b/pkgs/by-name/in/intel-oneapi/hpc.nix index 4454510ea5dd..181205a0ef76 100644 --- a/pkgs/by-name/in/intel-oneapi/hpc.nix +++ b/pkgs/by-name/in/intel-oneapi/hpc.nix @@ -26,12 +26,12 @@ level-zero, libffi, }: -intel-oneapi.mkIntelOneApi rec { +intel-oneapi.mkIntelOneApi (fa: { pname = "intel-oneapi-hpc-toolkit"; src = fetchurl { url = "https://registrationcenter-download.intel.com/akdlm/IRC_NAS/2d2a6686-ff06-44ce-baf0-ab84f8dafa89/intel-oneapi-hpc-toolkit-2025.2.1.44_offline.sh"; - sha256 = "1ys8s2nh6snjiz7aglag7awy12ww01z026hzcidzy68kxq71wba8"; + hash = "sha256-SC0eDu4TGf9bZB8aAX4AnIvguTpP0afOj9JqA63QSPs="; }; versionYear = "2025"; @@ -62,12 +62,12 @@ intel-oneapi.mkIntelOneApi rec { ]; passthru.updateScript = intel-oneapi.mkUpdateScript { - inherit pname; + inherit (fa) pname; file = "hpc.nix"; downloadPage = "https://www.intel.com/content/www/us/en/developer/tools/oneapi/hpc-toolkit-download.html?packages=hpc-toolkit&hpc-toolkit-os=linux&hpc-toolkit-lin=offline"; }; - meta = with lib; { + meta = { description = "Intel oneAPI HPC Toolkit"; homepage = "https://www.intel.com/content/www/us/en/developer/tools/oneapi/hpc-toolkit.html"; license = with lib.licenses; [ @@ -80,4 +80,4 @@ intel-oneapi.mkIntelOneApi rec { ]; platforms = [ "x86_64-linux" ]; }; -} +}) diff --git a/pkgs/by-name/in/intel-oneapi/package.nix b/pkgs/by-name/in/intel-oneapi/package.nix index 22465fc41fae..217756b9a9c1 100644 --- a/pkgs/by-name/in/intel-oneapi/package.nix +++ b/pkgs/by-name/in/intel-oneapi/package.nix @@ -12,28 +12,43 @@ writeShellScript, writeText, writeTextFile, + + # For the updater script + writeShellApplication, + curl, + jq, + htmlq, + common-updater-scripts, + writableTmpDirAsHomeHook, }: { - mkIntelOneApi = - { - pname, - versionYear, - versionMajor, - versionMinor, - versionRel, - src, - meta, - depsByComponent ? { }, - postInstall ? "", - components ? [ "default" ], - ... - }@args: - let - shortName = name: builtins.elemAt (lib.splitString "." name) 3; - in - stdenv.mkDerivation ( + mkIntelOneApi = lib.extendMkDerivation { + constructDrv = stdenv.mkDerivation; + + excludeDrvArgNames = [ + "depsByComponent" + "components" + ]; + + extendDrvArgs = fa: + { + pname, + versionYear, + versionMajor, + versionMinor, + versionRel, + src, + meta, + depsByComponent ? { }, + postInstall ? "", + components ? [ "default" ], + ... + }@args: + let + shortName = name: builtins.elemAt (lib.splitString "." name) 3; + in { version = "${fa.versionYear}.${fa.versionMajor}.${fa.versionMinor}.${fa.versionRel}"; @@ -45,21 +60,21 @@ bubblewrap autoPatchelfHook - - # For patchShebangs - python3 + writableTmpDirAsHomeHook ]; + buildInputs = [ + # For patchShebangs + python3 + ] # autoPatchelfHook will add these libraries to RPATH as required - buildInputs = lib.concatLists ( - map ( - comp: - if comp == "all" || comp == "default" then - lib.concatLists (builtins.attrValues depsByComponent) - else - depsByComponent.${shortName comp} or [ ] - ) components - ); + ++ lib.concatMap ( + comp: + if comp == "all" || comp == "default" then + lib.concatLists (builtins.attrValues depsByComponent) + else + depsByComponent.${shortName comp} or [ ] + ) components; phases = [ "installPhase" @@ -69,9 +84,6 @@ # 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 - # The installer expects a writeable home directory, even if installing elsewhere - export HOME="$(mktemp -d)" - # The installer expects that the installation directory is already present mkdir -p "$out" @@ -111,12 +123,8 @@ runHook postInstall ''; - } - // (builtins.removeAttrs args [ - "depsByComponent" - "components" - ]) - ); + }; + }; mkUpdateScript = { @@ -124,13 +132,15 @@ downloadPage, file, }: - writeTextFile { + writeShellApplication { name = "update-intel-oneapi"; - executable = true; + runtimeInputs = [ + curl + jq + htmlq + common-updater-scripts + ]; text = '' - #!/usr/bin/env nix-shell - #!nix-shell -i bash -p curl jq htmlq common-updater-scripts - download_page=${lib.escapeShellArg downloadPage} pname=${lib.escapeShellArg pname} nixpkgs="$(git rev-parse --show-toplevel)" @@ -158,11 +168,10 @@ fi if [[ "$(grep 'url =' "$file")" =~ "$url" ]] && [[ "''${BASH_REMATCH[0]}" == "$url" ]]; then - echo "The URL is the same ($url), skipping prefetch" >&2 - sha256="$(jq .sha256 < "$outFile")" + echo "The URL is the same ($url), skipping update" >&2 else echo "The new download URL is $url, prefetching it to store" >&2 - sha256=$(nix-prefetch-url --quiet "$url") + hash="$(nix-hash --to-sri --type sha256 "$(nix-prefetch-url --quiet "$url")")" fi sed -i "s|versionYear = \".*\";|versionYear = \"$versionYear\";|" "$file" @@ -170,7 +179,7 @@ sed -i "s|versionMinor = \".*\";|versionMinor = \"$versionMinor\";|" "$file" sed -i "s|versionRel = \".*\";|versionRel = \"$versionRel\";|" "$file" sed -i "s|url = \".*\";|url = \"$url\";|" "$file" - sed -i "s|sha256 = \".*\";|sha256 = \"$sha256\";|" "$file" + sed -i "s|hash = \".*\";|hash = \"$hash\";|" "$file" ''; }; diff --git a/pkgs/by-name/in/intel-oneapi/test.c b/pkgs/by-name/in/intel-oneapi/test.c new file mode 100644 index 000000000000..9413ac0c68e9 --- /dev/null +++ b/pkgs/by-name/in/intel-oneapi/test.c @@ -0,0 +1,12 @@ +#include + +#include + +int main() { + float u[] = {1., 2., 3.}; + float v[] = {4., 5., 6.}; + + float dp = cblas_sdot(3, u, 1, v, 1); + + assert(dp == 32.); +}