{ lib , stdenv , fetchFromGitHub , writeScript , cmake , rocm-cmake , rocm-runtime , rocm-device-libs , rocm-comgr , rocsparse , hip , gfortran , git , gtest , buildTests ? false }: # This can also use cuSPARSE as a backend instead of rocSPARSE stdenv.mkDerivation (finalAttrs: { pname = "hipsparse"; version = "5.3.3"; outputs = [ "out" ] ++ lib.optionals buildTests [ "test" ]; src = fetchFromGitHub { owner = "ROCmSoftwarePlatform"; repo = "hipSPARSE"; rev = "rocm-${finalAttrs.version}"; 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_