summary refs log tree commit diff
path: root/pkgs/tools/security/pinentry/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/security/pinentry/default.nix')
-rw-r--r--pkgs/tools/security/pinentry/default.nix42
1 files changed, 23 insertions, 19 deletions
diff --git a/pkgs/tools/security/pinentry/default.nix b/pkgs/tools/security/pinentry/default.nix
index 038044ad681..632edaedd2e 100644
--- a/pkgs/tools/security/pinentry/default.nix
+++ b/pkgs/tools/security/pinentry/default.nix
@@ -1,28 +1,32 @@
-{ fetchurl, stdenv, pkgconfig, glib
-, useGtk ? !stdenv.isDarwin, gtk
-, useNcurses ? true, ncurses
-, useQt4 ? false, qt4 }:
-
-assert useGtk || useNcurses || useQt4;
-
+{ fetchurl, stdenv, pkgconfig
+, libcap ? null, ncurses ? null, gtk2 ? null, qt4 ? null
+}:
+
+let
+  mkFlag = pfxTrue: pfxFalse: cond: name: "--${if cond then pfxTrue else pfxFalse}-${name}";
+  mkEnable = mkFlag "enable" "disable";
+  mkWith = mkFlag "with" "without";
+  hasX = gtk2 != null || qt4 != null;
+in
+with stdenv.lib;
 stdenv.mkDerivation rec {
-  name = "pinentry-0.8.3";
+  name = "pinentry-0.9.0";
 
   src = fetchurl {
     url = "mirror://gnupg/pinentry/${name}.tar.bz2";
-    sha256 = "1bd047crf7xb8g61mval8v6qww98rddlsw2dz6j8h8qbnl4hp2sn";
+    sha256 = "1awhajq21hcjgqfxg9czaxg555gij4bba6axrwg8w6lfmc3ml14h";
   };
 
-  buildInputs = let opt = stdenv.lib.optional; in []
-    ++ opt useGtk glib
-    ++ opt useGtk gtk
-    ++ opt useNcurses ncurses
-    ++ opt useQt4 qt4;
+  buildInputs = [ libcap gtk2 ncurses qt4 ];
 
-  configureFlags = [ "--disable-pinentry-gtk" "--disable-pinentry-qt" ]
-    ++ (if useGtk || useQt4 then ["--with-x"] else ["--without-x"])
-    ++ (if useGtk then ["--enable-pinentry-gtk2"] else ["--disable-pinentry-gtk"])
-    ++ (if useQt4 then ["--enable-pinentry-qt4"] else ["--disable-pinentry-qt4"]);
+  configureFlags = [
+    (mkWith   (libcap != null)  "libcap")
+    (mkWith   (hasX)            "x")
+    (mkEnable (ncurses != null) "pinentry-curses")
+    (mkEnable true              "pinentry-tty")
+    (mkEnable (gtk2 != null)    "pinentry-gtk2")
+    (mkEnable (qt4 != null)     "pinentry-qt4")
+  ];
 
   nativeBuildInputs = [ pkgconfig ];
 
@@ -30,7 +34,7 @@ stdenv.mkDerivation rec {
     homepage = "http://gnupg.org/aegypten2/";
     description = "GnuPG's interface to passphrase input";
     license = stdenv.lib.licenses.gpl2Plus;
-
+    platforms = stdenv.lib.platforms.all;
     longDescription = ''
       Pinentry provides a console and a GTK+ GUI that allows users to
       enter a passphrase when `gpg' or `gpg2' is run and needs it.