diff --git a/pkgs/by-name/sp/spral/package.nix b/pkgs/by-name/sp/spral/package.nix index e8376d81e716..885fe73d12d0 100644 --- a/pkgs/by-name/sp/spral/package.nix +++ b/pkgs/by-name/sp/spral/package.nix @@ -1,50 +1,66 @@ { - blas, - fetchFromGitHub, - gfortran, - lapack, + config, lib, - llvmPackages, - meson, - metis, - ninja, + + fetchFromGitHub, stdenv, + + nix-update-script, + + enableCuda ? config.cudaSupport, + + # nativeBuildInputs + cudaPackages, + gfortran, + meson, + ninja, + pkg-config, + + # buildInputs + blas, + hwloc, + lapack, + llvmPackages, + metis, }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "spral"; - version = "2025.01.08"; + version = "2025.05.20"; src = fetchFromGitHub { owner = "ralna"; repo = "spral"; - rev = "v${version}"; - hash = "sha256-tuhJClSjah/ud6PVr6biOq5KdKtspJ7hpWZ350yzz+U="; + tag = "v${finalAttrs.version}"; + hash = "sha256-9QEcAOFB3CtGNqr8LoDaj2vP3KMONlUVooeXECtGsxc="; }; - postPatch = - '' - # Skipped test: ssidst - # hwloc/linux: failed to find sysfs cpu topology directory, aborting linux discovery. - substituteInPlace tests/meson.build --replace-fail \ - "subdir('ssids')" \ - "" - '' - + lib.optionalString stdenv.hostPlatform.isDarwin '' - # Skipped test: lsmrt, segfault - substituteInPlace tests/meson.build --replace-fail \ - "['lsmrt', files('lsmr.f90')]," \ - "" - ''; + # Ignore a failing test on darwin + # ref. https://github.com/ralna/spral/issues/258 + postPatch = lib.optionalString stdenv.hostPlatform.isDarwin '' + substituteInPlace tests/ssids/meson.build --replace-fail \ + "spral_tests += [['ssids', 'ssidst', files('ssids.f90')]]" "" + ''; - nativeBuildInputs = [ - gfortran - meson - ninja + nativeBuildInputs = + [ + gfortran + meson + ninja + pkg-config + ] + ++ lib.optionals enableCuda [ + cudaPackages.cuda_nvcc + ]; + + propagatedBuildInputs = lib.optionals enableCuda [ + cudaPackages.cuda_cudart + cudaPackages.libcublas ]; buildInputs = [ blas + (hwloc.override { inherit enableCuda; }) lapack metis ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ llvmPackages.openmp ]; @@ -55,11 +71,13 @@ stdenv.mkDerivation rec { doCheck = true; + passthru.updateScript = nix-update-script { }; + meta = { description = "Sparse Parallel Robust Algorithms Library"; homepage = "https://github.com/ralna/spral"; - changelog = "https://github.com/ralna/spral/blob/${src.rev}/ChangeLog"; + changelog = "https://github.com/ralna/spral/releases/tag/${finalAttrs.src.tag}"; license = lib.licenses.bsd3; maintainers = with lib.maintainers; [ nim65s ]; }; -} +})