]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
distro/pkg/nix: synchronize from downstream nixpkgs
authorVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 31 Jul 2025 11:58:34 +0000 (13:58 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 31 Jul 2025 13:28:13 +0000 (15:28 +0200)
It's mostly just reformat, as nixpkgs has been moving to using
automatic formatting.  But also dnstap has been added, etc.
I checked that `apkg build` works again, of course :-)

distro/pkg/nix/default.nix
distro/pkg/nix/runtime-deps.patch

index 0cfaca1bfcd53882bd6ec0e9c84f60c91c867db4..a506e09a73b88696c45294e5afeabda62792f31a 100644 (file)
@@ -1,8 +1,34 @@
-{ lib, stdenv, fetchurl, pkg-config, gnutls, liburcu, lmdb, libcap_ng, libidn2, libunistring
-, systemd, nettle, libedit, zlib, libiconv, libintl, libmaxminddb, libbpf, nghttp2, libmnl
-, ngtcp2-gnutls, xdp-tools
-, autoreconfHook
-, nixosTests, knot-resolver, knot-dns, runCommandLocal
+{
+  lib,
+  stdenv,
+  fetchurl,
+  pkg-config,
+  gnutls,
+  liburcu,
+  lmdb,
+  libcap_ng,
+  libidn2,
+  libunistring,
+  systemd,
+  nettle,
+  libedit,
+  zlib,
+  libiconv,
+  libintl,
+  libmaxminddb,
+  libbpf,
+  nghttp2,
+  libmnl,
+  ngtcp2-gnutls,
+  xdp-tools,
+  fstrm,
+  protobufc,
+  sphinx,
+  autoreconfHook,
+  nixosTests,
+  knot-resolver,
+  knot-dns,
+  runCommandLocal,
 }:
 
 stdenv.mkDerivation rec {
@@ -14,12 +40,18 @@ stdenv.mkDerivation rec {
     sha256 = "{{ src_hash }}";
   };
 
-  outputs = [ "bin" "out" "dev" ];
+  outputs = [
+    "bin"
+    "out"
+    "dev"
+  ];
 
   configureFlags = [
     "--with-configdir=/etc/knot"
     "--with-rundir=/run/knot"
     "--with-storage=/var/lib/knot"
+    "--with-module-dnstap"
+    "--enable-dnstap"
   ];
 
   patches = [
@@ -29,24 +61,46 @@ stdenv.mkDerivation rec {
     ./runtime-deps.patch
   ];
 
-  nativeBuildInputs = [ pkg-config autoreconfHook ];
+  # FIXME: sphinx is needed for now to get man-pages
+  nativeBuildInputs = [
+    pkg-config
+    autoreconfHook
+    sphinx
+  ];
   buildInputs = [
-    gnutls liburcu libidn2 libunistring
-    nettle libedit
-    libiconv lmdb libintl
+    gnutls
+    liburcu
+    libidn2
+    libunistring
+    nettle
+    libedit
+    libiconv
+    lmdb
+    libintl
     nghttp2 # DoH support in kdig
-    ngtcp2-gnutls  # DoQ support in kdig (and elsewhere but not much use there yet)
+    ngtcp2-gnutls # DoQ support in kdig (and elsewhere but not much use there yet)
     libmaxminddb # optional for geoip module (it's tiny)
     # without sphinx &al. for developer documentation
-    # TODO: add dnstap support?
-  ] ++ lib.optionals stdenv.isLinux [
-    libcap_ng systemd
-    xdp-tools libbpf libmnl # XDP support (it's Linux kernel API)
-  ] ++ lib.optional stdenv.isDarwin zlib; # perhaps due to gnutls
+    fstrm
+    protobufc # dnstap support
+  ]
+  ++ lib.optionals stdenv.hostPlatform.isLinux [
+    libcap_ng
+    systemd
+    xdp-tools
+    libbpf
+    libmnl # XDP support (it's Linux kernel API)
+  ]
+  ++ lib.optional stdenv.hostPlatform.isDarwin zlib; # perhaps due to gnutls
 
   enableParallelBuilding = true;
 
-  CFLAGS = [ "-O2" "-DNDEBUG" ];
+  CFLAGS = [
+    "-O2"
+    "-DNDEBUG"
+  ];
+
+  __darwinAllowLocalNetworking = true;
 
   doCheck = true;
   checkFlags = [ "V=1" ]; # verbose output in case some test fails
@@ -58,29 +112,30 @@ stdenv.mkDerivation rec {
 
   passthru.tests = {
     inherit knot-resolver;
-  } // lib.optionalAttrs stdenv.isLinux {
+  }
+  // lib.optionalAttrs stdenv.hostPlatform.isLinux {
     inherit (nixosTests) knot kea;
+    prometheus-exporter = nixosTests.prometheus-exporters.knot;
     # Some dependencies are very version-sensitive, so the might get dropped
     # or embedded after some update, even if the nixPackagers didn't intend to.
     # For non-linux I don't know a good replacement for `ldd`.
-    deps = runCommandLocal "knot-deps-test"
-      { nativeBuildInputs = [ (lib.getBin stdenv.cc.libc) ]; }
-      ''
-        for libname in libngtcp2 libxdp libbpf; do
-          echo "Checking for $libname:"
-          ldd '${knot-dns.bin}/bin/knotd' | grep -F "$libname"
-          echo "OK"
-        done
-        touch "$out"
-      '';
+    deps = runCommandLocal "knot-deps-test" { nativeBuildInputs = [ (lib.getBin stdenv.cc.libc) ]; } ''
+      for libname in libngtcp2 libxdp libbpf; do
+        echo "Checking for $libname:"
+        ldd '${knot-dns.bin}/bin/knotd' | grep -F "$libname"
+        echo "OK"
+      done
+      touch "$out"
+    '';
   };
 
-  meta = with lib; {
+  meta = {
     description = "Authoritative-only DNS server from .cz domain registry";
     homepage = "https://knot-dns.cz";
-    license = licenses.gpl2Plus;
-    platforms = platforms.unix;
-    maintainers = [ maintainers.vcunat ];
+    changelog = "https://gitlab.nic.cz/knot/knot-dns/-/releases/v${version}";
+    license = lib.licenses.gpl2Plus;
+    platforms = lib.platforms.unix;
+    maintainers = [ lib.maintainers.vcunat ];
     mainProgram = "knotd";
   };
 }
index 19fc9cd07b18be6aa3058c200bab1076737e641a..89dba415b3b9208f93d790b3f4fae90be81cf032 100644 (file)
@@ -5,10 +5,9 @@ but that contains also references like include paths.
 Filter these at least in a crude way (whole lines).
 --- a/configure.ac
 +++ b/configure.ac
-@@ -766,5 +766,5 @@ result_msg_base="  Knot DNS $VERSION
--result_msg_esc=$(echo -n "$result_msg_base" | sed '$!s/$/\\n/' | tr -d '\n')
-+result_msg_esc=$(echo -n "$result_msg_base" | grep -Fv "$NIX_STORE" | sed '$!s/$/\\n/' | tr -d '\n')
+@@ -788,5 +788,5 @@ result_msg_base="
+-result_msg_esc=$(echo -n "    Configure:$filtered_config_params\n$result_msg_base" | sed '$!s/$/\\n/' | tr -d '\n')
++result_msg_esc=$(echo -n "    Configure:$filtered_config_params\n$result_msg_base" | grep -Fv "$NIX_STORE" | sed '$!s/$/\\n/' | tr -d '\n')
  
  AC_DEFINE_UNQUOTED([CONFIGURE_SUMMARY],["$result_msg_esc"],[Configure summary])