2021-01-17 03:51:22 +00:00
|
|
|
|
{ fetchurl, mkDerivation, fetchpatch, stdenv, lib, pkg-config, autoreconfHook, wrapGAppsHook
|
2021-09-04 20:05:03 +00:00
|
|
|
|
, libgpg-error, libassuan, qtbase, wrapQtAppsHook
|
2022-11-14 11:53:16 +00:00
|
|
|
|
, ncurses, gtk2, gcr
|
2022-12-05 01:42:36 +00:00
|
|
|
|
, withLibsecret ? true, libsecret
|
2021-08-13 04:32:40 +00:00
|
|
|
|
, enabledFlavors ? [ "curses" "tty" "gtk2" "emacs" ]
|
2021-08-12 20:17:54 +00:00
|
|
|
|
++ lib.optionals stdenv.isLinux [ "gnome3" ]
|
2022-01-01 22:05:26 +00:00
|
|
|
|
++ lib.optionals (!stdenv.isDarwin) [ "qt" ]
|
2015-03-25 23:09:00 +00:00
|
|
|
|
}:
|
|
|
|
|
|
2022-12-05 01:42:22 +00:00
|
|
|
|
assert lib.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
|
|
|
|
|
2022-07-09 11:37:24 +00:00
|
|
|
|
enableFeaturePinentry = f:
|
2018-10-27 14:01:19 +00:00
|
|
|
|
let
|
|
|
|
|
flag = flavorInfo.${f}.flag or null;
|
|
|
|
|
in
|
2022-12-05 01:42:22 +00:00
|
|
|
|
lib.optionalString (flag != null)
|
|
|
|
|
(lib.enableFeature (lib.elem f enabledFlavors) ("pinentry-" + flag));
|
2018-10-27 14:01:19 +00:00
|
|
|
|
|
|
|
|
|
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";
|
2022-11-14 11:53:16 +00:00
|
|
|
|
version = "1.2.1";
|
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";
|
2022-11-14 11:53:16 +00:00
|
|
|
|
sha256 = "sha256-RXoYXlqFI4+5RalV3GNSq5YtyLSHILYvyfpIx1QKQGc=";
|
2008-04-23 19:42:10 +00:00
|
|
|
|
};
|
|
|
|
|
|
2021-01-17 03:51:22 +00:00
|
|
|
|
nativeBuildInputs = [ pkg-config autoreconfHook ]
|
2022-12-05 01:42:22 +00:00
|
|
|
|
++ lib.concatMap(f: flavorInfo.${f}.nativeBuildInputs or []) enabledFlavors;
|
2022-11-14 11:53:16 +00:00
|
|
|
|
|
2022-12-05 01:42:36 +00:00
|
|
|
|
buildInputs = [ libgpg-error libassuan ]
|
|
|
|
|
++ lib.optional withLibsecret libsecret
|
2022-12-05 01:42:22 +00:00
|
|
|
|
++ lib.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
|
2022-12-05 01:42:22 +00:00
|
|
|
|
] ++ lib.optionals (lib.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 = [
|
2022-11-14 11:53:16 +00:00
|
|
|
|
(lib.enableFeature withLibsecret "libsecret")
|
2022-12-05 01:42:22 +00:00
|
|
|
|
] ++ (map enableFeaturePinentry (lib.attrNames flavorInfo));
|
2018-10-27 14:01:19 +00:00
|
|
|
|
|
|
|
|
|
postInstall =
|
2022-12-05 01:42:22 +00:00
|
|
|
|
lib.concatStrings (lib.flip map enabledFlavors (f:
|
2018-10-27 14:01:19 +00:00
|
|
|
|
let
|
|
|
|
|
binary = "pinentry-" + flavorInfo.${f}.bin;
|
|
|
|
|
in ''
|
|
|
|
|
moveToOutput bin/${binary} ${placeholder f}
|
|
|
|
|
ln -sf ${placeholder f}/bin/${binary} ${placeholder f}/bin/pinentry
|
2022-12-05 01:42:22 +00:00
|
|
|
|
'' + lib.optionalString (f == "gnome3") ''
|
2018-10-27 14:01:19 +00:00
|
|
|
|
wrapGApp ${placeholder f}/bin/${binary}
|
2022-12-05 01:42:22 +00:00
|
|
|
|
'' + lib.optionalString (f == "qt") ''
|
2018-10-27 14:01:19 +00:00
|
|
|
|
wrapQtApp ${placeholder f}/bin/${binary}
|
|
|
|
|
'')) + ''
|
2022-12-05 01:42:22 +00:00
|
|
|
|
ln -sf ${placeholder (lib.head enabledFlavors)}/bin/pinentry-${flavorInfo.${lib.head enabledFlavors}.bin} $out/bin/pinentry
|
2018-10-27 14:01:19 +00:00
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
outputs = [ "out" ] ++ enabledFlavors;
|
|
|
|
|
|
|
|
|
|
passthru = { flavors = enabledFlavors; };
|
2008-04-23 19:42:10 +00:00
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
|
meta = with 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
|
|
|
|
};
|
|
|
|
|
}
|