From 28e72a42c799e195d5fe17e6362abc37811facb8 Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Tue, 22 Jul 2025 14:38:58 +0200 Subject: [PATCH 1/3] gnupg: Remove broken mirrors None of these two mirrors have any of the sources these mirrors are used for, checked with `nix-build .src --check` while only those two are not commented. --- pkgs/build-support/fetchurl/mirrors.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkgs/build-support/fetchurl/mirrors.nix b/pkgs/build-support/fetchurl/mirrors.nix index 7e51efed66ac..1a412617835f 100644 --- a/pkgs/build-support/fetchurl/mirrors.nix +++ b/pkgs/build-support/fetchurl/mirrors.nix @@ -93,9 +93,7 @@ gnupg = [ "https://gnupg.org/ftp/gcrypt/" "https://mirrors.dotsrc.org/gcrypt/" - "https://ftp.heanet.ie/mirrors/ftp.gnupg.org/gcrypt/" "https://www.mirrorservice.org/sites/ftp.gnupg.org/gcrypt/" - "http://www.ring.gr.jp/pub/net/" ]; # IBiblio (former metalab/sunsite) From 12003e5b3a7fe65a1e070a52fbd9515effefe174 Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Tue, 22 Jul 2025 19:29:07 +0200 Subject: [PATCH 2/3] gnupg: Add patch comments --- pkgs/tools/security/gnupg/24.nix | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pkgs/tools/security/gnupg/24.nix b/pkgs/tools/security/gnupg/24.nix index d2a9462b193a..4f0b8a178981 100644 --- a/pkgs/tools/security/gnupg/24.nix +++ b/pkgs/tools/security/gnupg/24.nix @@ -76,6 +76,7 @@ stdenv.mkDerivation rec { ] ++ lib.optionals withTpm2Tss [ tpm2-tss ]; + # Maintained by Andrew Gallapher, who's involved with GPG in multiple ways: https://andrewg.com/ freepgPatches = fetchFromGitLab { domain = "gitlab.com"; owner = "freepg"; @@ -86,7 +87,16 @@ stdenv.mkDerivation rec { patches = [ + # Without this, scdaemon isn't linked to libusb, causing smartcards to not work correctly ./fix-libusb-include-path.patch + # Use pkg-config to find tss2-esys to fix static building + # Submitted upstream: https://dev.gnupg.org/D606 + # The diff is larger than upstream because configure.ac was modified, + # requiring configure to be regenerated. For reasons we don't totally + # understand, regenerating configure has all sorts of other undesirable + # side effects. So to unbreak things, instead of regenerating configure, + # we can include just the configure changes relevant to the static patch + # in the patch file. ./static.patch ] ++ lib.map (v: "${freepgPatches}/STABLE-BRANCH-2-4-freepg/" + v) [ @@ -116,6 +126,13 @@ stdenv.mkDerivation rec { ]; postPatch = + # Switch the default key server to keys.openpgp.org + # The original motivation in 2019 was to switch away from the then-default SKS network: https://github.com/NixOS/nixpkgs/pull/63952 + # In 2021 upstream also switched away, but to keyserver.ubuntu.com: https://dev.gnupg.org/rG47c4e3e00a7ef55f954c14b3c237496e54a853c1, + # while NixOS kept the keys.openpgp.org default: https://github.com/NixOS/nixpkgs/pull/159604 + # TODO: Should this patch be removed so that the now-uncompromised default is used once again? + # A significant difference between the two seems to be that keys.openpgp.org is verifying keys, while keyserver.ubuntu.com isn't: https://unix.stackexchange.com/a/694528 + # The keys.openpgp.org also has a great FAQ: https://keys.openpgp.org/about/faq '' sed -i 's,\(hkps\|https\)://keyserver.ubuntu.com,hkps://keys.openpgp.org,g' configure configure.ac doc/dirmngr.texi doc/gnupg.info-1 '' From f0c791e5104197c03181d8328fe6b7c1e920037f Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Tue, 22 Jul 2025 19:29:31 +0200 Subject: [PATCH 3/3] gnupg: Enable test suite --- pkgs/tools/security/gnupg/24.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/tools/security/gnupg/24.nix b/pkgs/tools/security/gnupg/24.nix index 4f0b8a178981..680a9ff4b088 100644 --- a/pkgs/tools/security/gnupg/24.nix +++ b/pkgs/tools/security/gnupg/24.nix @@ -21,6 +21,7 @@ readline, sqlite, zlib, + openssh, enableMinimal ? false, withPcsc ? !enableMinimal, pcsclite, @@ -145,6 +146,8 @@ stdenv.mkDerivation rec { configureFlags = [ "--sysconfdir=/etc" + # Needed for large RSA key support (patch 0033) + "--enable-large-secmem" "--with-libgpg-error-prefix=${libgpg-error.dev}" "--with-libgcrypt-prefix=${libgcrypt.dev}" "--with-libassuan-prefix=${libassuan.dev}" @@ -180,6 +183,12 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; + nativeCheckInputs = [ + # A test would be skipped without SSH + openssh + ]; + doCheck = !enableMinimal; + passthru.tests = nixosTests.gnupg; meta = with lib; {