about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/networking/mu/default.nix
blob: f94e83552130e0ab863124d8101d404fb7598a63 (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
{ lib
, stdenv
, fetchFromGitHub
, glibcLocales
, meson
, ninja
, pkg-config
, python3
, cld2
, coreutils
, emacs
, glib
, gmime3
, texinfo
, xapian
}:

stdenv.mkDerivation rec {
  pname = "mu";
  version = "1.12.1";

  outputs = [ "out" "mu4e" ];

  src = fetchFromGitHub {
    owner = "djcb";
    repo = "mu";
    rev = "v${version}";
    hash = "sha256-JnKvMbgkaZ1MO7cZMb2PGZsNMjV1M+dnaDpsBDsT0L4=";
  };

  postPatch = ''
    substituteInPlace lib/utils/mu-utils-file.cc \
      --replace-fail "/bin/rm" "${coreutils}/bin/rm"
    substituteInPlace lib/tests/bench-indexer.cc \
      --replace-fail "/bin/rm" "${coreutils}/bin/rm"
    substituteInPlace lib/mu-maildir.cc \
      --replace-fail "/bin/mv" "${coreutils}/bin/mv"
    patchShebangs build-aux/date.py
  '';

  postInstall = ''
    rm --verbose $mu4e/share/emacs/site-lisp/mu4e/*.elc
  '';

  # move only the mu4e info manual
  # this has to be after preFixup otherwise the info manual may be moved back by _multioutDocs()
  # we manually move the mu4e info manual instead of setting
  # outputInfo to mu4e because we do not want to move the mu-guile
  # info manual (if it exists)
  postFixup = ''
    moveToOutput share/info/mu4e.info.gz $mu4e
    install-info $mu4e/share/info/mu4e.info.gz $mu4e/share/info/dir
    if [[ -a ''${!outputInfo}/share/info/mu-guile.info.gz ]]; then
      install-info --delete $mu4e/share/info/mu4e.info.gz ''${!outputInfo}/share/info/dir
    else
      rm --verbose --recursive ''${!outputInfo}/share/info
    fi
  '';

  buildInputs = [ cld2 emacs glib gmime3 texinfo xapian ];

  mesonFlags = [
    "-Dguile=disabled"
    "-Dreadline=disabled"
    "-Dlispdir=${placeholder "mu4e"}/share/emacs/site-lisp"
  ];

  nativeBuildInputs = [ pkg-config meson ninja python3 glibcLocales ];

  doCheck = true;

  # Tests need a UTF-8 aware locale configured
  env.LANG = "C.UTF-8";

  meta = with lib; {
    description = "A collection of utilities for indexing and searching Maildirs";
    license = licenses.gpl3Plus;
    homepage = "https://www.djcbsoftware.nl/code/mu/";
    changelog = "https://github.com/djcb/mu/releases/tag/v${version}";
    maintainers = with maintainers; [ antono chvp peterhoeg ];
    mainProgram = "mu";
    platforms = platforms.unix;
  };
}