about summary refs log tree commit diff
path: root/pkgs/applications/networking/mailreaders/ayatana-webmail/default.nix
blob: 14be9ab4f3d6c7c2e0d123535fdcc69faf7ccf85 (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
{ lib
, fetchFromGitHub
, gettext
, gtk3
, python3Packages
, gdk-pixbuf
, libnotify
, glib
, gobject-introspection
, wrapGAppsHook
# BTW libappindicator is also supported, but upstream recommends their
# implementation, see:
# https://github.com/AyatanaIndicators/ayatana-webmail/issues/24#issuecomment-1050352862
, libayatana-appindicator
, gsettings-desktop-schemas
, libcanberra-gtk3
}:

python3Packages.buildPythonApplication rec {
  pname = "ayatana-webmail";
  version = "22.12.15";

  src = fetchFromGitHub {
    owner = "AyatanaIndicators";
    repo = "ayatana-webmail";
    rev = version;
    hash = "sha256-K2jqCWrY1i1wYdZVpjN/3TcVyWariOQQ4slZf6sEPRU=";
  };
  postConfigure = ''
    # Fix fhs paths
    substituteInPlace \
      ayatanawebmail/accounts.py \
      ayatanawebmail/actions.py \
      ayatanawebmail/dialog.py \
      --replace /usr/share $out/share
  '';

  buildInputs = [
    gtk3
    gdk-pixbuf
    glib
    libnotify
    gettext
    libayatana-appindicator
    gsettings-desktop-schemas
  ];

  nativeBuildInputs = [
    gobject-introspection
    wrapGAppsHook
    glib # For compiling gsettings-schemas
  ];

  propagatedBuildInputs = with python3Packages; [
    urllib3
    babel
    psutil
    secretstorage
    polib
    pygobject3
    dbus-python
  ];

  # No tests, and they cause a failure
  doCheck = false;

  postInstall = ''
    # Fix fhs paths
    mv $out/${python3Packages.python.sitePackages}/etc $out
    mv $out/${python3Packages.python.sitePackages}/usr/{bin,share} $out/
    rmdir $out/${python3Packages.python.sitePackages}/usr
    # Compile gsettings desktop schemas
    glib-compile-schemas $out/share/glib-2.0/schemas
  '';

  # See https://nixos.org/nixpkgs/manual/#ssec-gnome-common-issues-double-wrapped
  dontWrapGApps = true;
  preFixup = ''
    makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
    makeWrapperArgs+=(--prefix PATH : ${lib.makeBinPath [ libcanberra-gtk3 ]})
  '';

  meta = with lib; {
    description = "Webmail notifications and actions for any desktop";
    homepage = "https://github.com/AyatanaIndicators/ayatana-webmail";
    license = licenses.gpl3Plus;
    platforms = platforms.linux;
    maintainers = with maintainers; [ doronbehar ];
  };
}