nixpkgs/pkgs/tools/networking/aria2/default.nix
Harsh Shandilya 29bd4a3af9
aria2: build with GNUTLS instead of OpenSSL
aria2's OpenSSL integration breaks down when interacting with TLS v1.3
enabled websites which manifests in errors like these:

```
07/05 12:26:53 [NOTICE] Downloading 1 item(s)

07/05 12:26:54 [ERROR] CUID#7 - Download aborted. URI=https://catbox.moe
Exception: [AbstractCommand.cc:351] errorCode=1 URI=https://catbox.moe
  -> [SocketCore.cc:1018] errorCode=1 SSL/TLS handshake failure: protocol error
```

There are multiple instances[1] of users reporting this to the aria2 issue
tracker, and one of those issues[2] documents using GnuTLS in place of OpenSSL
as a workaround for the TLS v1.3 woes. I've verified that it indeed fixes
the problem, and hence making this change in Nixpkgs.

1: https://github.com/aria2/aria2/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+%22protocol+error%22
2: https://github.com/aria2/aria2/issues/1494
2023-07-06 17:34:49 +05:30

49 lines
1.3 KiB
Nix

{ lib, stdenv, fetchFromGitHub, pkg-config, autoreconfHook
, gnutls, c-ares, libxml2, sqlite, zlib, libssh2
, cppunit, sphinx
, Security
}:
stdenv.mkDerivation rec {
pname = "aria2";
version = "1.36.0";
src = fetchFromGitHub {
owner = "aria2";
repo = "aria2";
rev = "release-${version}";
sha256 = "sha256-ErjFfSJDIgZq0qy0Zn5uZ9bZS2AtJq4FuBVuUuQgPTI=";
};
strictDeps = true;
nativeBuildInputs = [ pkg-config autoreconfHook sphinx ];
buildInputs = [ gnutls c-ares libxml2 sqlite zlib libssh2 ] ++
lib.optional stdenv.isDarwin Security;
outputs = [ "bin" "dev" "out" "doc" "man" ];
configureFlags = [
"--with-ca-bundle=/etc/ssl/certs/ca-certificates.crt"
"--enable-libaria2"
"--with-bashcompletiondir=${placeholder "bin"}/share/bash-completion/completions"
];
prePatch = ''
patchShebangs --build doc/manual-src/en/mkapiref.py
'';
nativeCheckInputs = [ cppunit ];
doCheck = false; # needs the net
enableParallelBuilding = true;
meta = with lib; {
homepage = "https://aria2.github.io";
description = "A lightweight, multi-protocol, multi-source, command-line download utility";
mainProgram = "aria2c";
license = licenses.gpl2Plus;
platforms = platforms.unix;
maintainers = with maintainers; [ Br1ght0ne koral ];
};
}