{ lib , stdenv , fetchFromGitHub , writeScript , cmake , rocm-cmake , rocm-runtime , rocm-device-libs , rocm-comgr , rocprim , hip , gfortran , git , fetchzip ? null , gtest ? null , boost ? null , python3Packages ? null , buildTests ? false , buildBenchmarks ? false # Seems to depend on tests }: assert (buildTests || buildBenchmarks) -> fetchzip != null; assert (buildTests || buildBenchmarks) -> gtest != null; assert (buildTests || buildBenchmarks) -> boost != null; assert (buildTests || buildBenchmarks) -> python3Packages != null; let matrices = lib.optionalAttrs (buildTests || buildBenchmarks) import ./deps.nix { inherit fetchzip; mirror1 = "https://sparse.tamu.edu/MM"; mirror2 = "https://www.cise.ufl.edu/research/sparse/MM"; }; in stdenv.mkDerivation rec { pname = "rocsparse"; repoVersion = "2.3.2"; rocmVersion = "5.3.3"; version = "${repoVersion}-${rocmVersion}"; outputs = [ "out" ] ++ lib.optionals (buildTests || buildBenchmarks) [ "test" ] ++ lib.optionals buildBenchmarks [ "benchmark" ]; src = fetchFromGitHub { owner = "ROCmSoftwarePlatform"; repo = "rocSPARSE"; rev = "rocm-${rocmVersion}"; hash = "sha256-1069oBrIpZ4M9CAkzoQ9a5j3WlCXErirTbgTUZuT6b0="; }; nativeBuildInputs = [ cmake rocm-cmake hip gfortran ]; buildInputs = [ rocm-runtime rocm-device-libs rocm-comgr rocprim git ] ++ lib.optionals (buildTests || buildBenchmarks) [ gtest boost python3Packages.python python3Packages.pyyaml ]; cmakeFlags = [ "-DCMAKE_CXX_COMPILER=hipcc" # Manually define CMAKE_INSTALL_