2018-10-27 14:01:19 +00:00
|
|
|
|
{ fetchurl, mkDerivation, fetchpatch, stdenv, lib, pkgconfig, autoreconfHook, wrapGAppsHook
|
|
|
|
|
, libgpgerror, libassuan, qtbase, wrapQtAppsHook
|
|
|
|
|
, ncurses, gtk2, gcr
|
|
|
|
|
, libcap ? null, libsecret ? null
|
2020-10-01 04:20:00 +00:00
|
|
|
|
, enabledFlavors ? [ "curses" "tty" "gtk2" "qt" "emacs" ] ++ lib.optionals stdenv.isLinux [ "gnome3" ]
|
2015-03-25 23:09:00 +00:00
|
|
|
|
}:
|
|
|
|
|
|
2018-10-27 14:01:19 +00:00
|
|
|
|
with stdenv.lib;
|
|
|
|
|
|
|
|
|
|
assert isList enabledFlavors && enabledFlavors != [];
|
2019-07-24 16:26:16 +00:00
|
|
|
|
|
|
|
|
|
let
|
2018-10-27 14:01:19 +00:00
|
|
|
|
pinentryMkDerivation =
|
|
|
|
|
if (builtins.elem "qt" enabledFlavors)
|
|
|
|
|
then mkDerivation
|
2019-07-24 16:26:16 +00:00
|
|
|
|
else stdenv.mkDerivation;
|
2018-10-27 14:01:19 +00:00
|
|
|
|
|
|
|
|
|
mkFlag = pfxTrue: pfxFalse: cond: name:
|
|
|
|
|
"--${if cond then pfxTrue else pfxFalse}-${name}";
|
|
|
|
|
mkEnable = mkFlag "enable" "disable";
|
|
|
|
|
mkWith = mkFlag "with" "without";
|
|
|
|
|
|
|
|
|
|
mkEnablePinentry = f:
|
|
|
|
|
let
|
|
|
|
|
info = flavorInfo.${f};
|
|
|
|
|
flag = flavorInfo.${f}.flag or null;
|
|
|
|
|
in
|
|
|
|
|
optionalString (flag != null)
|
|
|
|
|
(mkEnable (elem f enabledFlavors) ("pinentry-" + flag));
|
|
|
|
|
|
|
|
|
|
flavorInfo = {
|
|
|
|
|
curses = { bin = "curses"; flag = "curses"; buildInputs = [ ncurses ]; };
|
|
|
|
|
tty = { bin = "tty"; flag = "tty"; };
|
|
|
|
|
gtk2 = { bin = "gtk-2"; flag = "gtk2"; buildInputs = [ gtk2 ]; };
|
|
|
|
|
gnome3 = { bin = "gnome3"; flag = "gnome3"; buildInputs = [ gcr ]; nativeBuildInputs = [ wrapGAppsHook ]; };
|
|
|
|
|
qt = { bin = "qt"; flag = "qt"; buildInputs = [ qtbase ]; nativeBuildInputs = [ wrapQtAppsHook ]; };
|
|
|
|
|
emacs = { bin = "emacs"; flag = "emacs"; buildInputs = []; };
|
|
|
|
|
};
|
|
|
|
|
|
2019-07-24 16:26:16 +00:00
|
|
|
|
in
|
|
|
|
|
|
2018-10-27 14:01:19 +00:00
|
|
|
|
pinentryMkDerivation rec {
|
|
|
|
|
pname = "pinentry";
|
|
|
|
|
version = "1.1.0";
|
2008-12-08 21:22:20 +00:00
|
|
|
|
|
|
|
|
|
src = fetchurl {
|
2018-10-27 14:01:19 +00:00
|
|
|
|
url = "mirror://gnupg/pinentry/${pname}-${version}.tar.bz2";
|
2017-12-16 02:42:32 +00:00
|
|
|
|
sha256 = "0w35ypl960pczg5kp6km3dyr000m1hf0vpwwlh72jjkjza36c1v8";
|
2008-04-23 19:42:10 +00:00
|
|
|
|
};
|
|
|
|
|
|
2018-10-27 14:01:19 +00:00
|
|
|
|
nativeBuildInputs = [ pkgconfig autoreconfHook ]
|
|
|
|
|
++ concatMap(f: flavorInfo.${f}.nativeBuildInputs or []) enabledFlavors;
|
|
|
|
|
buildInputs = [ libgpgerror libassuan libcap libsecret ]
|
|
|
|
|
++ concatMap(f: flavorInfo.${f}.buildInputs or []) enabledFlavors;
|
2011-06-07 21:50:12 +00:00
|
|
|
|
|
2018-10-27 14:01:19 +00:00
|
|
|
|
dontWrapGApps = true;
|
|
|
|
|
dontWrapQtApps = true;
|
2015-06-25 00:13:40 +00:00
|
|
|
|
|
2019-09-14 11:46:39 +00:00
|
|
|
|
patches = [
|
|
|
|
|
./autoconf-ar.patch
|
2018-10-27 14:01:19 +00:00
|
|
|
|
] ++ optionals (elem "gtk2" enabledFlavors) [
|
2017-07-24 11:38:07 +00:00
|
|
|
|
(fetchpatch {
|
2018-10-27 14:01:19 +00:00
|
|
|
|
url = "https://salsa.debian.org/debian/pinentry/raw/debian/1.1.0-1/debian/patches/0007-gtk2-When-X11-input-grabbing-fails-try-again-over-0..patch";
|
2018-02-25 20:21:40 +00:00
|
|
|
|
sha256 = "15r1axby3fdlzz9wg5zx7miv7gqx2jy4immaw4xmmw5skiifnhfd";
|
2017-12-16 02:52:37 +00:00
|
|
|
|
})
|
|
|
|
|
];
|
2017-07-24 11:38:07 +00:00
|
|
|
|
|
2015-03-25 23:09:00 +00:00
|
|
|
|
configureFlags = [
|
2018-10-27 14:01:19 +00:00
|
|
|
|
(mkWith (libcap != null) "libcap")
|
|
|
|
|
(mkEnable (libsecret != null) "libsecret")
|
|
|
|
|
] ++ (map mkEnablePinentry (attrNames flavorInfo));
|
|
|
|
|
|
|
|
|
|
postInstall =
|
|
|
|
|
concatStrings (flip map enabledFlavors (f:
|
|
|
|
|
let
|
|
|
|
|
binary = "pinentry-" + flavorInfo.${f}.bin;
|
|
|
|
|
in ''
|
|
|
|
|
moveToOutput bin/${binary} ${placeholder f}
|
|
|
|
|
ln -sf ${placeholder f}/bin/${binary} ${placeholder f}/bin/pinentry
|
|
|
|
|
'' + optionalString (f == "gnome3") ''
|
|
|
|
|
wrapGApp ${placeholder f}/bin/${binary}
|
|
|
|
|
'' + optionalString (f == "qt") ''
|
|
|
|
|
wrapQtApp ${placeholder f}/bin/${binary}
|
|
|
|
|
'')) + ''
|
|
|
|
|
ln -sf ${placeholder (head enabledFlavors)}/bin/pinentry-${flavorInfo.${head enabledFlavors}.bin} $out/bin/pinentry
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
outputs = [ "out" ] ++ enabledFlavors;
|
|
|
|
|
|
|
|
|
|
passthru = { flavors = enabledFlavors; };
|
2008-04-23 19:42:10 +00:00
|
|
|
|
|
2017-12-16 02:52:37 +00:00
|
|
|
|
meta = with stdenv.lib; {
|
2020-04-01 01:11:51 +00:00
|
|
|
|
homepage = "http://gnupg.org/aegypten2/";
|
2017-12-16 02:52:37 +00:00
|
|
|
|
description = "GnuPG’s interface to passphrase input";
|
|
|
|
|
license = licenses.gpl2Plus;
|
|
|
|
|
platforms = platforms.all;
|
2008-12-08 21:22:20 +00:00
|
|
|
|
longDescription = ''
|
2019-09-03 22:49:40 +00:00
|
|
|
|
Pinentry provides a console and (optional) GTK and Qt GUIs allowing users
|
2015-06-08 14:25:58 +00:00
|
|
|
|
to enter a passphrase when `gpg' or `gpg2' is run and needs it.
|
2008-12-08 21:22:20 +00:00
|
|
|
|
'';
|
2018-10-27 14:01:19 +00:00
|
|
|
|
maintainers = with maintainers; [ ttuegel fpletz ];
|
2008-04-23 19:42:10 +00:00
|
|
|
|
};
|
|
|
|
|
}
|