{ stdenv, fetchFromGitHub, qt6 }:
stdenv.mkDerivation rec {
  pname = "simc";
  version = "b1fd592079d1a673ab53ea96d699a6e56424b0ee";

  src = fetchFromGitHub rec {
    owner = "simulationcraft";
    repo = pname;
    rev = version;
    hash = "sha256-RPUCe7aoAYSNj9jv8HN7qhhxRIMmdCfhmUcr72VaHzg==";
  };

  nativeBuildInputs =
    [ qt6.wrapQtAppsHook qt6.qmake qt6.qtwebengine qt6.qtbase ];

  buildInputs = [ qt6.qtwayland ];

  configurePhase = ''
    qmake simulationcraft.pro
  '';

  buildPhase = ''
    SC_NO_NETWORKING=1 make -j$NIX_BUILD_CORES
  '';

  installPhase = ''
    mkdir -p $out/bin
    mv gui/SimulationCraft $out/bin
  '';

}
