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