1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 gtest,
7 c-ares,
8 curlHTTP3,
9 libev,
10}:
11
12let
13 curl' = curlHTTP3;
14in
15stdenv.mkDerivation rec {
16 pname = "https-dns-proxy";
17 # there are no stable releases (yet?)
18 version = "0-unstable-2024-11-18";
19
20 src = fetchFromGitHub {
21 owner = "aarond10";
22 repo = "https_dns_proxy";
23 rev = "484bd153bb85a51df1c5bede1b091be76537e0a7";
24 hash = "sha256-T4l3kQ2hPgmyKE7xzlkDDUD6AQi8dQPJQnw8NhUUhDY=";
25 };
26
27 postPatch = ''
28 substituteInPlace https_dns_proxy.service.in \
29 --replace "\''${CMAKE_INSTALL_PREFIX}/" ""
30 substituteInPlace munin/https_dns_proxy.plugin \
31 --replace '--unit https_dns_proxy.service' '--unit https-dns-proxy.service'
32 '';
33
34 nativeBuildInputs = [
35 cmake
36 gtest
37 ];
38
39 buildInputs = [
40 c-ares
41 curl'
42 libev
43 ];
44
45 postInstall = ''
46 install -Dm444 -t $out/share/doc/${pname} ../{LICENSE,*.md}
47 install -Dm444 -t $out/share/${pname}/munin ../munin/*
48 # the systemd service definition is garbage, and we use our own with NixOS
49 mv $out/lib/systemd $out/share/${pname}
50 rmdir $out/lib
51 '';
52
53 # upstream wants to add tests and the gtest framework is in place, so be ready
54 # for when that happens despite there being none as of right now
55 doCheck = true;
56
57 meta = with lib; {
58 description = "DNS to DNS over HTTPS (DoH) proxy";
59 license = licenses.mit;
60 maintainers = with maintainers; [ peterhoeg ];
61 platforms = platforms.linux;
62 mainProgram = "https_dns_proxy";
63 };
64}