about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/office/appflowy/default.nix
blob: 05bb88bdfe748f7d507f02f954b0ad5a6f1928f7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
{ stdenv,
  lib,
  fetchzip,
  autoPatchelfHook,
  makeWrapper,
  copyDesktopItems,
  makeDesktopItem,
  gtk3,
  openssl,
  xdg-user-dirs
}:

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

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

  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";
      categories = "Office;";
    })
  ];

  meta = with lib; {
    description = "An open-source alternative to Notion";
    homepage = "https://www.appflowy.io/";
    license = licenses.agpl3Only;
    changelog = "https://github.com/AppFlowy-IO/appflowy/releases/tag/${version}";
    maintainers = with maintainers; [ darkonion0 ];
    platforms = [ "x86_64-linux" ];
  };
}