Merge pull request #204573 from SuperSandro2000/pinentry-nox

This commit is contained in:
Sandro 2022-12-07 23:00:26 +01:00 committed by GitHub
commit 3758110622
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 18 deletions

View File

@ -43,6 +43,7 @@ with lib;
networkmanager-openvpn = super.networkmanager-openvpn.override { withGnome = false; };
networkmanager-sstp = super.networkmanager-vpnc.override { withGnome = false; };
networkmanager-vpnc = super.networkmanager-vpnc.override { withGnome = false; };
pinentry = super.pinentry.override { enabledFlavors = [ "curses" "tty" "emacs" ]; withLibsecret = false; };
qemu = super.qemu.override { gtkSupport = false; spiceSupport = false; sdlSupport = false; };
zbar = super.zbar.override { enableVideo = false; withXorg = false; };
}));

View File

@ -1,14 +1,13 @@
{ fetchurl, mkDerivation, fetchpatch, stdenv, lib, pkg-config, autoreconfHook, wrapGAppsHook
, libgpg-error, libassuan, qtbase, wrapQtAppsHook
, ncurses, gtk2, gcr, libcap, libsecret
, ncurses, gtk2, gcr, libcap
, withLibsecret ? true, libsecret
, enabledFlavors ? [ "curses" "tty" "gtk2" "emacs" ]
++ lib.optionals stdenv.isLinux [ "gnome3" ]
++ lib.optionals (!stdenv.isDarwin) [ "qt" ]
}:
with lib;
assert isList enabledFlavors && enabledFlavors != [];
assert lib.isList enabledFlavors && enabledFlavors != [];
let
pinentryMkDerivation =
@ -18,11 +17,10 @@ let
enableFeaturePinentry = f:
let
info = flavorInfo.${f};
flag = flavorInfo.${f}.flag or null;
in
optionalString (flag != null)
(enableFeature (elem f enabledFlavors) ("pinentry-" + flag));
lib.optionalString (flag != null)
(lib.enableFeature (lib.elem f enabledFlavors) ("pinentry-" + flag));
flavorInfo = {
curses = { bin = "curses"; flag = "curses"; buildInputs = [ ncurses ]; };
@ -45,17 +43,18 @@ pinentryMkDerivation rec {
};
nativeBuildInputs = [ pkg-config autoreconfHook ]
++ concatMap(f: flavorInfo.${f}.nativeBuildInputs or []) enabledFlavors;
buildInputs = [ libgpg-error libassuan libsecret ]
++ lib.concatMap(f: flavorInfo.${f}.nativeBuildInputs or []) enabledFlavors;
buildInputs = [ libgpg-error libassuan ]
++ lib.optional withLibsecret libsecret
++ lib.optional (!stdenv.isDarwin) libcap
++ concatMap(f: flavorInfo.${f}.buildInputs or []) enabledFlavors;
++ lib.concatMap(f: flavorInfo.${f}.buildInputs or []) enabledFlavors;
dontWrapGApps = true;
dontWrapQtApps = true;
patches = [
./autoconf-ar.patch
] ++ optionals (elem "gtk2" enabledFlavors) [
] ++ lib.optionals (lib.elem "gtk2" enabledFlavors) [
(fetchpatch {
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";
sha256 = "15r1axby3fdlzz9wg5zx7miv7gqx2jy4immaw4xmmw5skiifnhfd";
@ -63,23 +62,23 @@ pinentryMkDerivation rec {
];
configureFlags = [
(withFeature (libcap != null) "libcap")
(enableFeature (libsecret != null) "libsecret")
] ++ (map enableFeaturePinentry (attrNames flavorInfo));
(lib.withFeature (libcap != null) "libcap")
(lib.enableFeature withLibsecret "libsecret")
] ++ (map enableFeaturePinentry (lib.attrNames flavorInfo));
postInstall =
concatStrings (flip map enabledFlavors (f:
lib.concatStrings (lib.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") ''
'' + lib.optionalString (f == "gnome3") ''
wrapGApp ${placeholder f}/bin/${binary}
'' + optionalString (f == "qt") ''
'' + lib.optionalString (f == "qt") ''
wrapQtApp ${placeholder f}/bin/${binary}
'')) + ''
ln -sf ${placeholder (head enabledFlavors)}/bin/pinentry-${flavorInfo.${head enabledFlavors}.bin} $out/bin/pinentry
ln -sf ${placeholder (lib.head enabledFlavors)}/bin/pinentry-${flavorInfo.${lib.head enabledFlavors}.bin} $out/bin/pinentry
'';
outputs = [ "out" ] ++ enabledFlavors;