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 }:
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 meta = with lib;
38 metaCommon // {
39 description = "Modern asynchronous DNS API";
40 longDescription = ''
41 getdns is an implementation of a modern asynchronous DNS API; the
42 specification was originally edited by Paul Hoffman. It is intended to make all
43 types of DNS information easily available to application developers and non-DNS
44 experts. DNSSEC offers a unique global infrastructure for establishing and
45 enhancing cryptographic trust relations. With the development of this API the
46 developers intend to offer application developers a modern and flexible
47 interface that enables end-to-end trust in the DNS architecture, and which will
48 inspire application developers to implement innovative security solutions in
49 their applications.
50 '';
51 homepage = "https://getdnsapi.net";
52 };
53 };
54
55 stubby = stdenv.mkDerivation rec {
56 pname = "stubby";
57 version = "0.4.3";
58 outputs = [ "out" "man" "stubbyExampleJson" ];
59
60 inherit (getdns) src;
61 sourceRoot = "${getdns.pname}-${getdns.version}/stubby";
62
63 nativeBuildInputs = [ cmake doxygen yq ];
64
65 buildInputs = [ getdns libyaml openssl systemd ]
66 ++ lib.optionals stdenv.isDarwin [ darwin.Security ];
67
68 postInstall = ''
69 rm -r $out/share/doc
70 yq \
71 < $NIX_BUILD_TOP/$sourceRoot/stubby.yml.example \
72 > $stubbyExampleJson
73 '';
74
75 passthru.settingsExample = with builtins;
76 fromJSON (readFile stubby.stubbyExampleJson);
77
78 meta = with lib;
79 metaCommon // {
80 description = "Local DNS Privacy stub resolver (using DNS-over-TLS)";
81 mainProgram = "stubby";
82 longDescription = ''
83 Stubby is an application that acts as a local DNS Privacy stub
84 resolver (using RFC 7858, aka DNS-over-TLS). Stubby encrypts DNS
85 queries sent from a client machine (desktop or laptop) to a DNS
86 Privacy resolver increasing end user privacy. Stubby is developed by
87 the getdns team.
88 '';
89 homepage = "https://dnsprivacy.org/dns_privacy_daemon_-_stubby/";
90 };
91 };
92
93}