1# Getdns and Stubby are released together, see https://getdnsapi.net/releases/
2
3{ lib, stdenv, fetchurl, cmake, darwin, doxygen, libidn2, libyaml, openssl
4, systemd, unbound, yq, nimPackages }:
5let
6 metaCommon = with lib; {
7 maintainers = with maintainers; [ leenaars ehmry ];
8 license = licenses.bsd3;
9 platforms = platforms.all;
10 };
11in rec {
12
13 getdns = stdenv.mkDerivation rec {
14 pname = "getdns";
15 version = "1.7.3";
16 outputs = [ "out" "dev" "lib" "man" ];
17
18 src = fetchurl {
19 url = with lib; "https://getdnsapi.net/releases/${pname}-${concatStringsSep "-" (splitVersion version)}/${pname}-${version}.tar.gz";
20 # upstream publishes hashes in hex format
21 sha256 = "f1404ca250f02e37a118aa00cf0ec2cbe11896e060c6d369c6761baea7d55a2c";
22 };
23
24 nativeBuildInputs = [ cmake doxygen ];
25
26 buildInputs = [ libidn2 openssl unbound ];
27
28 # https://github.com/getdnsapi/getdns/issues/517
29 postPatch = ''
30 substituteInPlace getdns.pc.in \
31 --replace '$'{exec_prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@ \
32 --replace '$'{prefix}/@CMAKE_INSTALL_INCLUDEDIR@ @CMAKE_INSTALL_FULL_INCLUDEDIR@
33 '';
34
35 postInstall = "rm -r $out/share/doc";
36
37 passthru.tests.nim = nimPackages.getdns;
38
39 meta = with lib;
40 metaCommon // {
41 description = "A modern asynchronous DNS API";
42 longDescription = ''
43 getdns is an implementation of a modern asynchronous DNS API; the
44 specification was originally edited by Paul Hoffman. It is intended to make all
45 types of DNS information easily available to application developers and non-DNS
46 experts. DNSSEC offers a unique global infrastructure for establishing and
47 enhancing cryptographic trust relations. With the development of this API the
48 developers intend to offer application developers a modern and flexible
49 interface that enables end-to-end trust in the DNS architecture, and which will
50 inspire application developers to implement innovative security solutions in
51 their applications.
52 '';
53 homepage = "https://getdnsapi.net";
54 };
55 };
56
57 stubby = stdenv.mkDerivation rec {
58 pname = "stubby";
59 version = "0.4.3";
60 outputs = [ "out" "man" "stubbyExampleJson" ];
61
62 inherit (getdns) src;
63 sourceRoot = "${getdns.pname}-${getdns.version}/stubby";
64
65 nativeBuildInputs = [ cmake doxygen yq ];
66
67 buildInputs = [ getdns libyaml openssl systemd ]
68 ++ lib.optionals stdenv.isDarwin [ darwin.Security ];
69
70 postInstall = ''
71 rm -r $out/share/doc
72 yq \
73 < $NIX_BUILD_TOP/$sourceRoot/stubby.yml.example \
74 > $stubbyExampleJson
75 '';
76
77 passthru.settingsExample = with builtins;
78 fromJSON (readFile stubby.stubbyExampleJson);
79
80 meta = with lib;
81 metaCommon // {
82 description = "A local DNS Privacy stub resolver (using DNS-over-TLS)";
83 longDescription = ''
84 Stubby is an application that acts as a local DNS Privacy stub
85 resolver (using RFC 7858, aka DNS-over-TLS). Stubby encrypts DNS
86 queries sent from a client machine (desktop or laptop) to a DNS
87 Privacy resolver increasing end user privacy. Stubby is developed by
88 the getdns team.
89 '';
90 homepage = "https://dnsprivacy.org/wiki/x/JYAT";
91 };
92 };
93
94}