about summary refs log tree commit diff
path: root/pkgs/by-name/af/affine/package.nix
blob: d484bc94e5667affc3070f7c98f2c83c7c7bc9c3 (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
{ lib
, writeText
, fetchurl
, stdenvNoCC
, copyDesktopItems
, makeDesktopItem
, makeWrapper
, unzip
, bash
, electron
, commandLineArgs ? ""
}:

stdenvNoCC.mkDerivation (finalAttrs: let
  icon = fetchurl {
    url = "https://raw.githubusercontent.com/toeverything/AFFiNE/v${finalAttrs.version}/packages/frontend/core/public/favicon-192.png";
    hash = "sha256-smZ5W7fy3TK3bvjwV4i71j2lVmKSZcyhMhcWfPxNnN4=";
  };
in {
  pname = "affine";
  version = "0.13.3";
  src = fetchurl {
    url = "https://github.com/toeverything/AFFiNE/releases/download/v${finalAttrs.version}/affine-${finalAttrs.version}-stable-linux-x64.zip";
    hash = "sha256-w/5X7PFLHVILg1XCYkGefBQ4c+Ko+ME0Lu8iAtCaTFg=";
  };
  nativeBuildInputs = [
    copyDesktopItems
    makeWrapper
    unzip
  ];
  postInstall = ''
    mkdir -p $out/lib
    cp -r ./resources/* -t $out/lib/
    cp LICENSE* $out/
    install -Dm644 ${icon} $out/share/pixmaps/affine.png
    makeWrapper "${electron}/bin/electron" $out/bin/affine \
      --inherit-argv0 \
      --add-flags $out/lib/app.asar \
      --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
      --add-flags ${lib.escapeShellArg commandLineArgs}
  '';
  desktopItems = [
    (makeDesktopItem {
      name = "affine";
      desktopName = "AFFiNE";
      exec = "affine %U";
      terminal = false;
      icon = "affine";
      startupWMClass = "affine";
      categories = ["Utility"];
    })
  ];
  meta = with lib; {
    description = "A workspace with fully merged docs, whiteboards and databases";
    longDescription = ''
      AFFiNE is an open-source, all-in-one workspace and an operating
      system for all the building blocks that assemble your knowledge
      base and much more -- wiki, knowledge management, presentation
      and digital assets
    '';
    homepage = "https://affine.pro/";
    downloadPage = "https://affine.pro/download";
    license = licenses.mit;
    maintainers = with maintainers; [richar];
    mainProgram = "affine";
    platforms = ["x86_64-linux"];
  };
})