{
  lib,
  buildNpmPackage,
  fetchFromGitHub,
  pkgs,
}: let
  port = 2143;
  configFile =
    pkgs.writeText "config.json"
    ''
      {
          "defaultHomeserver": 0,
          "homeserverList": [
              "matrix.gladtherescake.eu"
          ],
          "allowCustomHomeservers": false
      }
    '';
in
  buildNpmPackage rec {
    pname = "cinny";
    version = "09a0a2d";

    src = fetchFromGitHub {
      owner = "cinnyapp";
      repo = pname;
      rev = "${version}";
      hash = "sha256-ee8YOJ0fGy26OWXb2Uumzy68M4UpERHH3ni0q+tDY14=";
    };

    npmDepsHash = "sha256-zelk15/rXXjhWuHj1GsSevnyXVBeDkMJ0qZfPyejq4A=";

    # The prepack script runs the build script, which we'd rather do in the build phase.
    npmPackFlags = ["--ignore-scripts" "--max_old_space_size=4096"];

    installPhase = ''
      mkdir $out
      npm run build
      cp -r dist/* $out
      mkdir $out/app
      cp ${configFile} $out/app/config.json
    '';

    meta = with lib; {
      description = "Yet another matrix client";
      homepage = "https://cinny.in/";
      license = licenses.agpl3O;
      maintainers = with maintainers; [Lillian-Violet];
    };
  }