Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 83 lines 1.7 kB view raw
1{ 2 config, 3 lib, 4 5 fetchFromGitHub, 6 stdenv, 7 8 nix-update-script, 9 10 enableCuda ? config.cudaSupport, 11 12 # nativeBuildInputs 13 cudaPackages, 14 gfortran, 15 meson, 16 ninja, 17 pkg-config, 18 19 # buildInputs 20 blas, 21 hwloc, 22 lapack, 23 llvmPackages, 24 metis, 25}: 26 27stdenv.mkDerivation (finalAttrs: { 28 pname = "spral"; 29 version = "2025.05.20"; 30 31 src = fetchFromGitHub { 32 owner = "ralna"; 33 repo = "spral"; 34 tag = "v${finalAttrs.version}"; 35 hash = "sha256-9QEcAOFB3CtGNqr8LoDaj2vP3KMONlUVooeXECtGsxc="; 36 }; 37 38 # Ignore a failing test on darwin 39 # ref. https://github.com/ralna/spral/issues/258 40 postPatch = lib.optionalString stdenv.hostPlatform.isDarwin '' 41 substituteInPlace tests/ssids/meson.build --replace-fail \ 42 "spral_tests += [['ssids', 'ssidst', files('ssids.f90')]]" "" 43 ''; 44 45 nativeBuildInputs = [ 46 gfortran 47 meson 48 ninja 49 pkg-config 50 ] 51 ++ lib.optionals enableCuda [ 52 cudaPackages.cuda_nvcc 53 ]; 54 55 propagatedBuildInputs = lib.optionals enableCuda [ 56 cudaPackages.cuda_cudart 57 cudaPackages.libcublas 58 ]; 59 60 buildInputs = [ 61 blas 62 (hwloc.override { inherit enableCuda; }) 63 lapack 64 metis 65 ] 66 ++ lib.optionals stdenv.hostPlatform.isDarwin [ llvmPackages.openmp ]; 67 68 mesonFlags = [ (lib.mesonBool "tests" true) ]; 69 70 LDFLAGS = lib.optionals stdenv.hostPlatform.isDarwin [ "-lomp" ]; 71 72 doCheck = true; 73 74 passthru.updateScript = nix-update-script { }; 75 76 meta = { 77 description = "Sparse Parallel Robust Algorithms Library"; 78 homepage = "https://github.com/ralna/spral"; 79 changelog = "https://github.com/ralna/spral/releases/tag/${finalAttrs.src.tag}"; 80 license = lib.licenses.bsd3; 81 maintainers = with lib.maintainers; [ nim65s ]; 82 }; 83})