{
  fetchgit,
  php,
  dataDir ? "/var/lib/think-backend-gtcm",
}:
let
  repoSrc = fetchgit {
    url = "https://git.b4l.co.th/newedge/think-greaterchiangmai";
    rev = "7c17aa78436538241c09fc7d633904d3c063011e";
    hash = "sha256-GDx0+PmuCXC+UPtsvsocCZQiTPcnOZEzJI17sxrVv7Q=";
  };
  src = "${repoSrc}/think-backend.greaterchiangmai.com";
in
php.buildComposerProject2 (finalAttrs: {
  pname = "think-backend-gtcm";
  version = "1.0.0";

  inherit src;

  installPhase = ''
    runHook preInstall
    mkdir -p $out
    cp -R * $out

    rm -rf $out/storage

    ln -s ${dataDir}/.env $out/.env
    ln -s ${dataDir}/storage $out/storage
    ln -s ${dataDir}/public/storage $out/public/storage
    ln -s ${dataDir}/public/uploads $out/public/uploads
    runHook postInstall
  '';

  composerStrictValidation = false;
  vendorHash = "sha256-wGfbprSDULBje1s5y3+ZiU/nCwYGDEULobZzyzGZ9bQ=";
})
