18 , pythonSupport ? false
20 # only for passthru.tests
25 inherit (stdenv.hostPlatform) system;
27 stdenv.mkDerivation rec {
32 url = "mirror://gnupg/gpgme/${pname}-${version}.tar.bz2";
33 hash = "sha256-BD4u/hi0rSK5bUNN3nY/vtMs+NbCINxp3w0P+53Gb8Y=";
37 # Support Python 3.10 version detection without distutils, https://dev.gnupg.org/D545
38 ./python-310-detection-without-distutils.patch
39 # Fix a test after disallowing compressed signatures in gpg (PR #180336)
40 ./test_t-verify_double-plaintext.patch
43 outputs = [ "out" "dev" "info" ];
45 outputBin = "dev"; # gpgme-config; not so sure about gpgme-tool
52 ] ++ lib.optionals pythonSupport [
53 python3.pythonOnBuildForHost
59 buildInputs = lib.optionals pythonSupport [
63 propagatedBuildInputs = [
68 ] ++ lib.optionals (qtbase != null) [
77 buildPackages.stdenv.cc
80 dontWrapQtApps = true;
83 "--enable-fixed-path=${gnupg}/bin"
84 "--with-libgpg-error-prefix=${libgpg-error.dev}"
85 "--with-libassuan-prefix=${libassuan.dev}"
86 ] ++ lib.optional pythonSupport "--enable-languages=python"
87 # Tests will try to communicate with gpg-agent instance via a UNIX socket
88 # which has a path length limit. Nix on darwin is using a build directory
89 # that already has quite a long path and the resulting socket path doesn't
90 # fit in the limit. https://github.com/NixOS/nix/pull/1085
91 ++ lib.optionals stdenv.isDarwin [ "--disable-gpg-test" ];
93 env.NIX_CFLAGS_COMPILE = toString (
94 # qgpgme uses Q_ASSERT which retains build inputs at runtime unless
95 # debugging is disabled
96 lib.optional (qtbase != null) "-DQT_NO_DEBUG"
97 # https://www.gnupg.org/documentation/manuals/gpgme/Largefile-Support-_0028LFS_0029.html
98 ++ lib.optional stdenv.hostPlatform.is32bit "-D_FILE_OFFSET_BITS=64"
101 enableParallelBuilding = true;
103 # prevent tests from being run during the buildPhase
104 makeFlags = [ "tests=" ];
108 checkFlags = [ "-C" "tests" ];
111 python = python3.pkgs.gpgme;
112 qt = libsForQt5.qgpgme;
116 homepage = "https://gnupg.org/software/gpgme/index.html";
117 changelog = "https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gpgme.git;f=NEWS;hb=gpgme-${version}";
118 description = "Library for making GnuPG easier to use";
120 GnuPG Made Easy (GPGME) is a library designed to make access to GnuPG
121 easier for applications. It provides a High-Level Crypto API for
122 encryption, decryption, signing, signature verification and key
125 license = with licenses; [ lgpl21Plus gpl3Plus ];
126 platforms = platforms.unix;
127 maintainers = with maintainers; [ dotlambda ];