{ lib , stdenv , fetchFromGitHub , writeScript , cmake , rocm-cmake , rocm-runtime , rocm-device-libs , rocm-comgr , rocsparse , hip , gfortran , git , fetchzip ? null , gtest ? null , buildTests ? false }: assert buildTests -> fetchzip != null; assert buildTests -> gtest != null; # This can also use cuSPARSE as a backend instead of rocSPARSE let matrices = lib.optionalAttrs buildTests import ./deps.nix { inherit fetchzip; mirror1 = "https://sparse.tamu.edu/MM"; mirror2 = "https://www.cise.ufl.edu/research/sparse/MM"; }; in stdenv.mkDerivation (finalAttrs: { pname = "hipsparse"; repoVersion = "2.3.1"; rocmVersion = "5.3.3"; version = "${finalAttrs.repoVersion}-${finalAttrs.rocmVersion}"; outputs = [ "out" ] ++ lib.optionals buildTests [ "test" ]; src = fetchFromGitHub { owner = "ROCmSoftwarePlatform"; repo = "hipSPARSE"; rev = "rocm-${finalAttrs.rocmVersion}"; hash = "sha256-Phcihat774ZSAe1QetE/GSZzGlnCnvS9GwsHBHCaD4c="; }; nativeBuildInputs = [ cmake rocm-cmake hip gfortran ]; buildInputs = [ rocm-runtime rocm-device-libs rocm-comgr rocsparse git ] ++ lib.optionals buildTests [ gtest ]; cmakeFlags = [ "-DCMAKE_CXX_COMPILER=hipcc" # Manually define CMAKE_INSTALL_