{ lib , stdenv , fetchFromGitHub , writeScript , cmake , rocm-cmake , rocm-runtime , rocm-device-libs , rocm-comgr , hip , gtest ? null , gbenchmark ? null , buildTests ? false , buildBenchmarks ? false }: assert buildTests -> gtest != null; assert buildBenchmarks -> gbenchmark != null; stdenv.mkDerivation (finalAttrs: { pname = "rocprim"; repoVersion = "2.11.1"; rocmVersion = "5.3.3"; version = "${finalAttrs.repoVersion}-${finalAttrs.rocmVersion}"; outputs = [ "out" ] ++ lib.optionals buildTests [ "test" ] ++ lib.optionals buildBenchmarks [ "benchmark" ]; src = fetchFromGitHub { owner = "ROCmSoftwarePlatform"; repo = "rocPRIM"; rev = "rocm-${finalAttrs.rocmVersion}"; hash = "sha256-jfTuGEPyssARpdo0ZnfVJt0MBkoHnmBtf6Zg4xXNJ1U="; }; nativeBuildInputs = [ cmake rocm-cmake hip ]; buildInputs = [ rocm-runtime rocm-device-libs rocm-comgr ] ++ lib.optionals buildTests [ gtest ] ++ lib.optionals buildBenchmarks [ gbenchmark ]; cmakeFlags = [ "-DCMAKE_CXX_COMPILER=hipcc" # Manually define CMAKE_INSTALL_