forgejo-lts: 7.0.10 -> 7.0.11
[NixPkgs.git] / pkgs / development / libraries / getdns / default.nix
blobb85dc689d96cf65f34f40176d83096b9be61f145
1 # Getdns and Stubby are released together, see https://getdnsapi.net/releases/
3 { lib, stdenv, fetchurl, cmake, darwin, doxygen, libidn2, libyaml, openssl
4 , systemd, unbound, yq }:
5 let
6   metaCommon = {
7     maintainers = with lib.maintainers; [ leenaars ehmry ];
8     license = lib.licenses.bsd3;
9     platforms = lib.platforms.all;
10   };
11 in rec {
13   getdns = stdenv.mkDerivation rec {
14     pname = "getdns";
15     version = "1.7.3";
16     outputs = [ "out" "dev" "lib" "man" ];
18     src = fetchurl {
19       url = "https://getdnsapi.net/releases/${pname}-${lib.concatStringsSep "-" (lib.splitVersion version)}/${pname}-${version}.tar.gz";
20       # upstream publishes hashes in hex format
21       sha256 = "f1404ca250f02e37a118aa00cf0ec2cbe11896e060c6d369c6761baea7d55a2c";
22     };
24     nativeBuildInputs = [ cmake doxygen ];
26     buildInputs = [ libidn2 openssl unbound ];
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     '';
35     postInstall = "rm -r $out/share/doc";
37     meta = metaCommon // {
38       description = "Modern asynchronous DNS API";
39       longDescription = ''
40         getdns is an implementation of a modern asynchronous DNS API; the
41         specification was originally edited by Paul Hoffman. It is intended to make all
42         types of DNS information easily available to application developers and non-DNS
43         experts. DNSSEC offers a unique global infrastructure for establishing and
44         enhancing cryptographic trust relations. With the development of this API the
45         developers intend to offer application developers a modern and flexible
46         interface that enables end-to-end trust in the DNS architecture, and which will
47         inspire application developers to implement innovative security solutions in
48         their applications.
49       '';
50       homepage = "https://getdnsapi.net";
51     };
52   };
54   stubby = stdenv.mkDerivation rec {
55     pname = "stubby";
56     version = "0.4.3";
57     outputs = [ "out" "man" "stubbyExampleJson" ];
59     inherit (getdns) src;
60     sourceRoot = "${getdns.pname}-${getdns.version}/stubby";
62     nativeBuildInputs = [ cmake doxygen yq ];
64     buildInputs = [ getdns libyaml openssl systemd ]
65       ++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.Security ];
67     postInstall = ''
68       rm -r $out/share/doc
69       yq \
70         < $NIX_BUILD_TOP/$sourceRoot/stubby.yml.example \
71         > $stubbyExampleJson
72     '';
74     passthru.settingsExample = builtins.fromJSON (builtins.readFile stubby.stubbyExampleJson);
76     meta = metaCommon // {
77       description = "Local DNS Privacy stub resolver (using DNS-over-TLS)";
78       mainProgram = "stubby";
79       longDescription = ''
80         Stubby is an application that acts as a local DNS Privacy stub
81         resolver (using RFC 7858, aka DNS-over-TLS). Stubby encrypts DNS
82         queries sent from a client machine (desktop or laptop) to a DNS
83         Privacy resolver increasing end user privacy. Stubby is developed by
84         the getdns team.
85       '';
86       homepage = "https://dnsprivacy.org/dns_privacy_daemon_-_stubby/";
87     };
88   };