nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 186 lines 4.5 kB view raw
1{ 2 stdenv, 3 lib, 4 fetchurl, 5 fetchpatch, 6 pkg-config, 7 autoreconfHook, 8 wrapGAppsHook3, 9 kdePackages, 10 libgpg-error, 11 libassuan, 12 libsForQt5, 13 qt6, 14 ncurses, 15 gtk2, 16 gcr, 17 withLibsecret ? true, 18 libsecret, 19}: 20 21let 22 flavorInfo = { 23 tty = { 24 flag = "tty"; 25 }; 26 curses = { 27 flag = "curses"; 28 buildInputs = [ ncurses ]; 29 }; 30 gtk2 = { 31 flag = "gtk2"; 32 buildInputs = [ gtk2 ]; 33 }; 34 gnome3 = { 35 flag = "gnome3"; 36 buildInputs = [ gcr ]; 37 nativeBuildInputs = [ wrapGAppsHook3 ]; 38 }; 39 qt5 = { 40 flag = "qt5"; 41 buildInputs = [ 42 libsForQt5.qtbase 43 libsForQt5.kwayland 44 libsForQt5.qtx11extras 45 ]; 46 nativeBuildInputs = [ libsForQt5.wrapQtAppsHook ]; 47 }; 48 qt = { 49 flag = "qt"; 50 buildInputs = [ 51 qt6.qtbase 52 qt6.qtwayland 53 kdePackages.kguiaddons 54 ]; 55 nativeBuildInputs = [ qt6.wrapQtAppsHook ]; 56 }; 57 emacs = { 58 flag = "emacs"; 59 }; 60 }; 61 62 buildPinentry = 63 pinentryExtraPname: buildFlavors: 64 let 65 enableFeaturePinentry = 66 f: lib.enableFeature (lib.elem f buildFlavors) ("pinentry-" + flavorInfo.${f}.flag); 67 in 68 stdenv.mkDerivation rec { 69 pname = "pinentry-${pinentryExtraPname}"; 70 version = "1.3.1"; 71 72 src = fetchurl { 73 url = "mirror://gnupg/pinentry/pinentry-${version}.tar.bz2"; 74 hash = "sha256-vHLuJ8cjkAerGJbDwvrlOwduLJvSSD3CdpoWkCvOjAQ="; 75 }; 76 77 nativeBuildInputs = [ 78 pkg-config 79 autoreconfHook 80 ] 81 ++ lib.concatMap (f: flavorInfo.${f}.nativeBuildInputs or [ ]) buildFlavors; 82 83 buildInputs = [ 84 libgpg-error 85 libassuan 86 ] 87 ++ lib.optional withLibsecret libsecret 88 ++ lib.concatMap (f: flavorInfo.${f}.buildInputs or [ ]) buildFlavors; 89 90 dontWrapGApps = true; 91 dontWrapQtApps = true; 92 93 patches = [ 94 ./autoconf-ar.patch 95 ./gettext-0.25.patch 96 ] 97 ++ lib.optionals (lib.elem "gtk2" buildFlavors) [ 98 (fetchpatch { 99 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"; 100 sha256 = "15r1axby3fdlzz9wg5zx7miv7gqx2jy4immaw4xmmw5skiifnhfd"; 101 }) 102 ]; 103 104 configureFlags = [ 105 "--with-libgpg-error-prefix=${libgpg-error.dev}" 106 "--with-libassuan-prefix=${libassuan.dev}" 107 (lib.enableFeature withLibsecret "libsecret") 108 ] 109 ++ (map enableFeaturePinentry (lib.attrNames flavorInfo)); 110 111 postInstall = 112 lib.optionalString (lib.elem "gnome3" buildFlavors) '' 113 wrapGApp $out/bin/pinentry-gnome3 114 '' 115 + lib.optionalString (lib.elem "qt5" buildFlavors) '' 116 wrapQtApp $out/bin/pinentry-qt5 117 ln -sf $out/bin/pinentry-qt5 $out/bin/pinentry-qt 118 '' 119 + lib.optionalString (lib.elem "qt" buildFlavors) '' 120 wrapQtApp $out/bin/pinentry-qt 121 ''; 122 123 passthru = { 124 flavors = buildFlavors; 125 }; 126 127 meta = { 128 homepage = "https://gnupg.org/software/pinentry/index.html"; 129 description = "GnuPGs interface to passphrase input"; 130 license = lib.licenses.gpl2Plus; 131 platforms = 132 if lib.elem "gnome3" buildFlavors then 133 lib.platforms.linux 134 else if (lib.elem "qt5" buildFlavors || lib.elem "qt" buildFlavors) then 135 (lib.remove "aarch64-darwin" lib.platforms.all) 136 else 137 lib.platforms.all; 138 longDescription = '' 139 Pinentry provides a console and (optional) GTK and Qt GUIs allowing users 140 to enter a passphrase when `gpg` or `gpg2` is run and needs it. 141 ''; 142 maintainers = with lib.maintainers; [ fpletz ]; 143 mainProgram = "pinentry"; 144 }; 145 }; 146in 147{ 148 pinentry-curses = buildPinentry "curses" [ 149 "curses" 150 "tty" 151 ]; 152 pinentry-emacs = buildPinentry "emacs" [ 153 "emacs" 154 "curses" 155 "tty" 156 ]; 157 pinentry-gnome3 = buildPinentry "gnome3" [ 158 "gnome3" 159 "curses" 160 "tty" 161 ]; 162 pinentry-gtk2 = buildPinentry "gtk2" [ 163 "gtk2" 164 "curses" 165 "tty" 166 ]; 167 pinentry-qt5 = buildPinentry "qt5" [ 168 "qt5" 169 "curses" 170 "tty" 171 ]; 172 pinentry-qt = buildPinentry "qt" [ 173 "qt" 174 "curses" 175 "tty" 176 ]; 177 pinentry-tty = buildPinentry "tty" [ "tty" ]; 178 pinentry-all = buildPinentry "all" [ 179 "curses" 180 "tty" 181 "gtk2" 182 "gnome3" 183 "qt" 184 "emacs" 185 ]; 186}