-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ngtcp2-gnutls: init at 0.7.0 and use in knot-dns #188383
Conversation
It's not that useful for now, but it only adds about 0.4 MB in closure. $ kdig @ns1.xdp.cz +quic news.xdp.cz TXT
@Izorkin might want to know about the split or comment. Anyway, I don't expect significant usage of the openssl variant before the official openssl is made compatible with QUIC. |
Not working this variant? index 90372cc97a2..8c75eb1b8c5 100644
--- a/pkgs/development/libraries/ngtcp2/default.nix
+++ b/pkgs/development/libraries/ngtcp2/default.nix
@@ -1,10 +1,14 @@
{ lib, stdenv, fetchFromGitHub
, autoreconfHook, pkg-config, file
-, libev, nghttp3, quictls
+, libev, nghttp3
, cunit, ncurses
, withJemalloc ? false, jemalloc
+, withGnutls ? false, gnutls
+, withQuictls ? true, quictls
}:
+assert !(withGnutls && withQuictls);
+
stdenv.mkDerivation rec {
pname = "ngtcp2";
version = "0.7.0";
@@ -19,9 +23,16 @@ stdenv.mkDerivation rec {
outputs = [ "out" "dev" "doc" ];
nativeBuildInputs = [ autoreconfHook pkg-config file ];
- buildInputs = [ libev nghttp3 quictls ] ++ lib.optional withJemalloc jemalloc;
+
+ buildInputs = [ libev nghttp3 ]
+ ++ lib.optional withQuictls quictls
+ ++ lib.optional withGnutls gnutls
+ ++ lib.optional withJemalloc jemalloc;
+
checkInputs = [ cunit ncurses ];
+ configureFlags = lib.optional withGnutls "--with-gnutls=yes";
+
preConfigure = ''
substituteInPlace ./configure --replace /usr/bin/file ${file}/bin/file
'';
diff --git a/pkgs/servers/dns/knot-dns/default.nix b/pkgs/servers/dns/knot-dns/default.nix
index 23fefe80e76..fff31f86df3 100644
--- a/pkgs/servers/dns/knot-dns/default.nix
+++ b/pkgs/servers/dns/knot-dns/default.nix
@@ -1,5 +1,5 @@
{ lib, stdenv, fetchurl, pkg-config, gnutls, liburcu, lmdb, libcap_ng, libidn2, libunistring
-, systemd, nettle, libedit, zlib, libiconv, libintl, libmaxminddb, libbpf, nghttp2, libmnl
+, systemd, nettle, libedit, zlib, libiconv, libintl, libmaxminddb, libbpf, ngtcp2, nghttp2, libmnl
, autoreconfHook, nixosTests, knot-resolver
}:
@@ -32,6 +32,7 @@ stdenv.mkDerivation rec {
gnutls liburcu libidn2 libunistring
nettle libedit
libiconv lmdb libintl
+ ngtcp2
nghttp2 # DoH support in kdig
libmaxminddb # optional for geoip module (it's tiny)
# without sphinx &al. for developer documentation
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index bb0430ef58d..6d7576bacef 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -22657,7 +22657,10 @@ with pkgs;
keycloak = callPackage ../servers/keycloak { };
- knot-dns = callPackage ../servers/dns/knot-dns { };
+ knot-dns = callPackage ../servers/dns/knot-dns {
+ ngtcp2 = ngtcp2.override { withGnutls = true; withQuictls = false; };
+ };
+
knot-resolver = callPackage ../servers/dns/knot-resolver {
systemd = systemdMinimal; # in closure already anyway
}; |
Yes, it's certainly possible to merge this way into one nix expression. But I might also need ngtcp2 version kept in lock-step with knot-dns. Until nghtcp2 development stabilizes. So the overal code sharing opportunities don't seem significant. |
Then it will be easier to have two variants. |
No, it only uses gnutls for crypto. (including parts that are not related to TLS or QUIC) |
Why split from ./default.nix? | ||
|
||
ngtcp2 libs contain helpers to plug into various crypto libs (gnutls, patched openssl, ...). | ||
Building multiple of them while keeping closures separable would be relatively complicated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be a problem to compile openssl and gnutls into one package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You would need to put each of these into a separate output (and leaving the base lib in a third one) – and then patch paths in pkg-config and libtool files. That is, if the closure blowup should be avoided.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"blowup" according to the comment it is not even 1MB, or am I missing something? Are the new deps bigger?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, that's a different one. The openssl fork takes a few megabytes and gnutls+deps also (and each additional crypto lib that you'd add). Packages always want just one but they'd get all of them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The potential blowup in this comment is for the situation that got merged. That is you maybe need (through different packages) ngtcp2 with both openssl and gnutls, in which case you get the core twice. And the core is 0.3--0.4 MB.
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)nixos/doc/manual/md-to-db.sh
to update generated release notes