mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-14 09:43:14 +00:00
ac4f5079f7
This patch packages mu4e as an Emacs lisp package based on the mu4e output of the multiple-output package mu, which makes mu4e a good citizen of Emacs lisp packages in two aspects. First, mu4e now utilizes the Emacs lisp package infrastructure in Nixpkgs. This allows users who want to do AOT native compilation for non-default Emacs variants[0] to build only mu4e itself instead of the whole mu package[1]. Second, mu4e now conforms to the Emacs builtin package manager[2]. Without this patch, mu4e autoloaded commands do not work out-of-the-box[3] because its directory is added to load-path by site-start.el after the initialization of package-directory-list, which causes package-activate-all to not load mu4e-autoloads.el. This patch fixes this issue when mu4e is installed to Emacs using the withPackages wrapper[4]. [0]: such as emacs-pgtk [1]: mu.override { emacs = emacs-pgtk; } [2]: package.el [3]: either (require 'mu4e) or (require 'mu4e-autoloads) is needed to be called before an autoloaded command is called [4]: emacs-pgtk.pkgs.withPackages (epkgs: [ epkgs.mu4e ])
86 lines
2.2 KiB
Nix
86 lines
2.2 KiB
Nix
{ lib
|
|
, stdenv
|
|
, fetchFromGitHub
|
|
, meson
|
|
, ninja
|
|
, pkg-config
|
|
, coreutils
|
|
, emacs
|
|
, glib
|
|
, gmime3
|
|
, texinfo
|
|
, xapian
|
|
, fetchpatch
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "mu";
|
|
version = "1.10.7";
|
|
|
|
outputs = [ "out" "mu4e" ];
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "djcb";
|
|
repo = "mu";
|
|
rev = "v${version}";
|
|
hash = "sha256-x1TsyTOK5U6/Y3QInm+XQ7T32X49iwa+4UnaHdiyqCI=";
|
|
};
|
|
|
|
patches = [
|
|
(fetchpatch {
|
|
name = "add-mu4e-pkg.el";
|
|
url = "https://github.com/djcb/mu/commit/00f7053d51105eea0c72151f1a8cf0b6d8478e4e.patch";
|
|
hash = "sha256-21c7djmYTcqyyygqByo9vu/GsH8WMYcq8NOAvJsS5AQ=";
|
|
})
|
|
];
|
|
|
|
postPatch = ''
|
|
# Fix mu4e-builddir (set it to $out)
|
|
substituteInPlace mu4e/mu4e-config.el.in \
|
|
--replace "@abs_top_builddir@" "$out"
|
|
substituteInPlace lib/utils/mu-test-utils.cc \
|
|
--replace "/bin/rm" "${coreutils}/bin/rm"
|
|
'';
|
|
|
|
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 = [ emacs glib gmime3 texinfo xapian ];
|
|
|
|
mesonFlags = [
|
|
"-Dguile=disabled"
|
|
"-Dreadline=disabled"
|
|
"-Dlispdir=${placeholder "mu4e"}/share/emacs/site-lisp"
|
|
];
|
|
|
|
nativeBuildInputs = [ pkg-config meson ninja ];
|
|
|
|
doCheck = true;
|
|
|
|
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;
|
|
};
|
|
}
|