From bdbfd7744644952d099f8e6080b9ab223169ab93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Bon=C3=A9?= Date: Mon, 19 May 2025 17:49:15 +0200 Subject: [PATCH] Simplify findMatch in intel-oneapi 2023 This should be a noop --- pkgs/intel-oneapi/2023.nix | 39 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 26 deletions(-) diff --git a/pkgs/intel-oneapi/2023.nix b/pkgs/intel-oneapi/2023.nix index fa2bd30..239457b 100644 --- a/pkgs/intel-oneapi/2023.nix +++ b/pkgs/intel-oneapi/2023.nix @@ -54,34 +54,24 @@ let ''; }; - aptPackages = import aptPackageIndex; - - apthost = "https://apt.repos.intel.com/oneapi/"; - - getSum = pkgList: name: + findMatch = name: let - matches = lib.filter (x: name == x.Package) pkgList; - #n = lib.length matches; - #match = builtins.trace (name + " -- ${builtins.toString n}") (lib.elemAt matches 0); - match = lib.elemAt matches 0; - in - match.SHA256; - - getUrl = pkgList: name: - let - matches = lib.filter (x: name == x.Package) pkgList; - #match = assert lib.length matches == 1; lib.elemAt matches 0; + aptPackages = import aptPackageIndex; + matches = lib.filter (x: name == x.Package) aptPackages; n = lib.length matches; - match = - #builtins.trace (name + " -- n=${builtins.toString n}") - (lib.elemAt matches 0); + match = builtins.traceVerbose (name + " -- ${builtins.toString n}") (builtins.head matches); + + apthost = "https://apt.repos.intel.com/oneapi/"; in - apthost + match.Filename; + { + url = apthost + match.Filename; + sha256 = match.SHA256; + }; uncompressDebs = debs: name: stdenv.mkDerivation { name = name; srcs = debs; - buildInputs = [ dpkg ]; + nativeBuildInputs = [ dpkg ]; phases = [ "installPhase" ]; installPhase = '' mkdir -p $out @@ -94,10 +84,7 @@ let joinDebs = name: names: let - urls = builtins.map (x: getUrl aptPackages x) names; - sums = builtins.map (x: getSum aptPackages x) names; - getsrc = url: sha256: builtins.fetchurl { inherit url sha256; }; - debs = lib.zipListsWith getsrc urls sums; + debs = builtins.map (x: builtins.fetchurl (findMatch x)) names; in uncompressDebs debs "${name}-source"; @@ -454,7 +441,7 @@ let ''; }; - ifort-wrapper = wrapIntel rec { + ifort-wrapper = wrapIntel { cc = intel-compiler-fortran; mygcc = gcc; extraBuild = ''