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-openvpn = super.networkmanager-openvpn.override { withGnome = false; };
networkmanager-sstp = super.networkmanager-vpnc.override { withGnome = false; }; networkmanager-sstp = super.networkmanager-vpnc.override { withGnome = false; };
networkmanager-vpnc = 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; }; qemu = super.qemu.override { gtkSupport = false; spiceSupport = false; sdlSupport = false; };
zbar = super.zbar.override { enableVideo = false; withXorg = false; }; zbar = super.zbar.override { enableVideo = false; withXorg = false; };
})); }));

View File

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