summary refs log tree commit diff
path: root/pkgs/applications/editors
diff options
context:
space:
mode:
authorThomas Tuegel <ttuegel@gmail.com>2015-04-09 10:56:18 -0500
committerThomas Tuegel <ttuegel@gmail.com>2015-04-09 11:38:46 -0500
commitbc4f39f48b1fe56e807edd7b77bd41e955b9f651 (patch)
treeb45f8ee6b339cd05cfca7d8ffefab6e93f07e0f8 /pkgs/applications/editors
parentc6f47a5e9efa5ad985a96461ad8653c2b1b7fd51 (diff)
downloadnixpkgs-bc4f39f48b1fe56e807edd7b77bd41e955b9f651.tar
nixpkgs-bc4f39f48b1fe56e807edd7b77bd41e955b9f651.tar.gz
nixpkgs-bc4f39f48b1fe56e807edd7b77bd41e955b9f651.tar.bz2
nixpkgs-bc4f39f48b1fe56e807edd7b77bd41e955b9f651.tar.lz
nixpkgs-bc4f39f48b1fe56e807edd7b77bd41e955b9f651.tar.xz
nixpkgs-bc4f39f48b1fe56e807edd7b77bd41e955b9f651.tar.zst
nixpkgs-bc4f39f48b1fe56e807edd7b77bd41e955b9f651.zip
emacs: allow choosing gtk2 or gtk3
Diffstat (limited to 'pkgs/applications/editors')
-rw-r--r--pkgs/applications/editors/emacs-24/default.nix30
1 files changed, 21 insertions, 9 deletions
diff --git a/pkgs/applications/editors/emacs-24/default.nix b/pkgs/applications/editors/emacs-24/default.nix
index 83774206b5c..f5379780c5d 100644
--- a/pkgs/applications/editors/emacs-24/default.nix
+++ b/pkgs/applications/editors/emacs-24/default.nix
@@ -2,11 +2,24 @@
 , pkgconfig, gtk, libXft, dbus, libpng, libjpeg, libungif
 , libtiff, librsvg, texinfo, gconf, libxml2, imagemagick, gnutls
 , alsaLib, cairo
-, withX ? !stdenv.isDarwin, withGTK ? true
+, withX ? !stdenv.isDarwin
+, withGTK3 ? false, gtk3 ? null
+, withGTK2 ? true, gtk2
 }:
 
 assert (libXft != null) -> libpng != null;	# probably a bug
 assert stdenv.isDarwin -> libXaw != null;	# fails to link otherwise
+assert withGTK2 -> withX;
+assert withGTK3 -> withX;
+assert withGTK2 -> !withGTK3 && gtk2 != null;
+assert withGTK3 -> !withGTK2 && gtk3 != null;
+
+let
+  toolkit =
+    if withGTK3 then "gtk3"
+    else if withGTK2 then "gtk2"
+    else "lucid";
+in
 
 stdenv.mkDerivation rec {
   name = "emacs-24.4";
@@ -28,17 +41,16 @@ stdenv.mkDerivation rec {
     ++ stdenv.lib.optional stdenv.isLinux dbus
     ++ stdenv.lib.optionals withX
       [ x11 libXaw Xaw3d libXpm libpng libjpeg libungif libtiff librsvg libXft
-        imagemagick gtk gconf ]
+        imagemagick gconf ]
+    ++ stdenv.lib.optional (withX && withGTK2) [ gtk2 ]
+    ++ stdenv.lib.optional (withX && withGTK3) [ gtk3 ]
     ++ stdenv.lib.optional (stdenv.isDarwin && withX) cairo;
 
   configureFlags =
-    ( if withX && withGTK then
-        [ "--with-x-toolkit=gtk" "--with-xft"]
-      else (if withX then
-        [ "--with-x-toolkit=lucid" "--with-xft" ]
-      else
-        [ "--with-x=no" "--with-xpm=no" "--with-jpeg=no" "--with-png=no"
-          "--with-gif=no" "--with-tiff=no" ] ) );
+    if withX
+      then [ "--with-x-toolkit=${toolkit}" "--with-xft" ]
+      else [ "--with-x=no" "--with-xpm=no" "--with-jpeg=no" "--with-png=no"
+             "--with-gif=no" "--with-tiff=no" ];
 
   NIX_CFLAGS_COMPILE = stdenv.lib.optionalString (stdenv.isDarwin && withX)
     "-I${cairo}/include/cairo";