<commit_before>{ stdenv,
  lib,
  fetchzip,
  autoPatchelfHook,
  makeWrapper,
  copyDesktopItems,
  makeDesktopItem,
  gtk3,
  openssl,
  xdg-user-dirs
}:

stdenv.mkDerivation rec {
  pname = "appflowy";
  version = "0.0.3";

  src = fetchzip {
    url = "https://github.com/AppFlowy-IO/appflowy/releases/download/${version}/AppFlowy-linux-x86.tar.gz";
    sha256 = "sha256-m9vfgytSKnWLf6hwKjIGcU/7OCmIBiF4hJ/yIRBdSpQ=";
  };

  nativeBuildInputs = [
      autoPatchelfHook
      makeWrapper
      copyDesktopItems
  ];

  buildInputs = [
      gtk3
      openssl
  ];

  dontBuild = true;
  dontConfigure = true;

  installPhase = ''
    runHook preInstall

    mkdir -p $out/opt/
    mkdir -p $out/bin/

    # Copy archive contents to the outpout directory
    cp -r ./* $out/opt/

    runHook postInstall
  '';

  preFixup = let
    libPath = lib.makeLibraryPath [
      xdg-user-dirs
    ];
  in ''
    # Add missing libraries to appflowy using the ones it comes with
    makeWrapper $out/opt/app_flowy $out/bin/appflowy \
          --set LD_LIBRARY_PATH "$out/opt/lib/:${libPath}"
  '';

  desktopItems = [
    (makeDesktopItem {
      name = pname;
      desktopName = "AppFlowy";
      comment = meta.description;
      exec = "appflowy";<commit_msg>appflowy: fix error xdg-user-dir not found<commit_after>{ stdenv,
  lib,
  fetchzip,
  autoPatchelfHook,
  makeWrapper,
  copyDesktopItems,
  makeDesktopItem,
  gtk3,
  openssl,
  xdg-user-dirs
}:

stdenv.mkDerivation rec {
  pname = "appflowy";
  version = "0.0.3";

  src = fetchzip {
    url = "https://github.com/AppFlowy-IO/appflowy/releases/download/${version}/AppFlowy-linux-x86.tar.gz";
    sha256 = "sha256-m9vfgytSKnWLf6hwKjIGcU/7OCmIBiF4hJ/yIRBdSpQ=";
  };

  nativeBuildInputs = [
      autoPatchelfHook
      makeWrapper
      copyDesktopItems
  ];

  buildInputs = [
      gtk3
      openssl
  ];

  dontBuild = true;
  dontConfigure = true;

  installPhase = ''
    runHook preInstall

    mkdir -p $out/opt/
    mkdir -p $out/bin/

    # Copy archive contents to the outpout directory
    cp -r ./* $out/opt/

    runHook postInstall
  '';

  preFixup = let
    binPath = lib.makeBinPath [
      xdg-user-dirs
    ];
  in ''
    # Add missing libraries to appflowy using the ones it comes with
    makeWrapper $out/opt/app_flowy $out/bin/appflowy \
          --set LD_LIBRARY_PATH "$out/opt/lib/" \
          --prefix PATH : "${binPath}"
  '';

  desktopItems = [
    (makeDesktopItem {
      name = pname;
      desktopName = "AppFlowy";
      comment = meta.description;
      exec = "appflowy";
{'fraction_non_alphanumeric': 0.11746402178140801, 'fraction_numerical': 0.013224426293271101, 'mean_word_length': 2.5040871934604905, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3424993', 'n_tokens_mistral': 1001, 'n_tokens_neox': 949, 'n_words': 183}