Skip to content

Instantly share code, notes, and snippets.

@jperras

jperras/mu.nix Secret

Created May 14, 2020 16:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jperras/54e38f195f641314414654ab64f3fed6 to your computer and use it in GitHub Desktop.
Save jperras/54e38f195f641314414654ab64f3fed6 to your computer and use it in GitHub Desktop.
Adjusted mu.nix to allow for optional Guile linking
{ stdenv, fetchFromGitHub, sqlite, pkgconfig, autoreconfHook, pmccabe
, xapian, glib, gmime3, texinfo , emacs, guile
, gtk3, webkitgtk, libsoup, icu
, withMug ? false
, batchSize ? null
, withGuile ? true }:
stdenv.mkDerivation rec {
pname = "mu";
version = "1.4.3";
src = fetchFromGitHub {
owner = "djcb";
repo = "mu";
rev = version;
sha256 = "1i9chd8ks1q4g5pyscsir6pw4kahkx3k8ckzbi8j3gr6jz1qzzsg";
};
postPatch = stdenv.lib.optionalString (batchSize != null) ''
sed -i lib/mu-store.cc --regexp-extended \
-e 's@(constexpr auto BatchSize).*@\1 = ${toString batchSize};@'
'';
buildInputs = [
sqlite xapian glib gmime3 texinfo emacs libsoup icu
]
++ stdenv.lib.optionals withMug [ gtk3 webkitgtk ]
++ stdenv.lib.optionals withGuile [ guile ];
nativeBuildInputs = [ pkgconfig autoreconfHook pmccabe ];
enableParallelBuilding = true;
preBuild = ''
# Fix mu4e-builddir (set it to $out)
substituteInPlace mu4e/mu4e-meta.el.in \
--replace "@abs_top_builddir@" "$out"
'';
configureFlags = stdenv.lib.optional (!withGuile) [ "--disable-guile" ];
# Install mug
postInstall = stdenv.lib.optionalString withMug ''
for f in mug ; do
install -m755 toys/$f/$f $out/bin/$f
done
'';
doCheck = true;
meta = with stdenv.lib; {
description = "A collection of utilties for indexing and searching Maildirs";
license = licenses.gpl3Plus;
homepage = "https://www.djcbsoftware.nl/code/mu/";
maintainers = with maintainers; [ antono peterhoeg ];
platforms = platforms.mesaPlatforms;
};
}
@jperras
Copy link
Author

jperras commented May 14, 2020

When attempting to build via:

nix-build -A mu --arg withGuile false

The derivation still attempts to link against guile, meaning that --disable-guile is not passed as argument to ./configure. If I remove all the conditionals and simply set configureFlags = [ "--disable-guile" ];, it builds correctly (without linking against guile).

What am I doing wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment