{ pkgs
, fetchFromGitHub
, cmake
, gcc12Stdenv ? pkgs.gcc12Stdenv
, cudaPackages ? pkgs.cudaPackages
}:

gcc12Stdenv.mkDerivation rec {
  pname = "thundersvm";
  version = "git";

  src = fetchFromGitHub {
    owner = "Xtra-Computing";
    repo = "thundersvm";
    rev = "5c6a056ac7f474b085d5415c81c5d48a1419642a";
    sha256 = "sha256-58YtOC8FK1d3ATETmwrEBc+/SQx0Pzlx5L1MgxXPQDE=";
  };

  nativeBuildInputs = [
    cmake
  ];

  buildInputs = [
    cudaPackages.cudatoolkit
  ];

  meta = with pkgs.lib; {
    description = "ThunderSVM CLI and library (compiled with CUDA)";
    homepage = "https://github.com/Xtra-Computing/thundersvm";
    license = licenses.asl20;
    maintainers = [];
    platforms = platforms.linux;
  };
}

