From patchwork Sat Nov 9 09:19:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5a6L5paH5q2m?= X-Patchwork-Id: 16060 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 37A86176B6; Sat, 9 Nov 2019 09:21:18 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id F01F217694 for ; Sat, 9 Nov 2019 09:21:17 +0000 (GMT) Received: from localhost ([::1]:35458 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iTMvl-0007SI-El for patchwork@mira.cbaines.net; Sat, 09 Nov 2019 04:21:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42623) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iTMvX-0007Gc-Im for guix-patches@gnu.org; Sat, 09 Nov 2019 04:21:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iTMvW-0003QY-Dh for guix-patches@gnu.org; Sat, 09 Nov 2019 04:21:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:39360) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iTMvW-0003QU-Am for guix-patches@gnu.org; Sat, 09 Nov 2019 04:21:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iTMvW-00076l-5C for guix-patches@gnu.org; Sat, 09 Nov 2019 04:21:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#38145] [PATCH 1/3] gnu: Add python-breathe. References: <20191109091628.6861-1-iyzsong@member.fsf.org> In-Reply-To: <20191109091628.6861-1-iyzsong@member.fsf.org> Resent-From: =?utf-8?b?5a6L5paH5q2m?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 09 Nov 2019 09:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38145 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 38145@debbugs.gnu.org Cc: =?utf-8?b?5a6L5paH5q2m?= Received: via spool by 38145-submit@debbugs.gnu.org id=B38145.157329121427196 (code B ref 38145); Sat, 09 Nov 2019 09:21:02 +0000 Received: (at 38145) by debbugs.gnu.org; 9 Nov 2019 09:20:14 +0000 Received: from localhost ([127.0.0.1]:48172 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iTMuk-00074a-8N for submit@debbugs.gnu.org; Sat, 09 Nov 2019 04:20:14 -0500 Received: from rezeros.cc ([45.76.207.221]:48234) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iTMui-00074H-LN for 38145@debbugs.gnu.org; Sat, 09 Nov 2019 04:20:13 -0500 Received: from localhost (2409:8a62:377:8a30:bf58:dc29:dc78:3014 [IPv6:2409:8a62:377:8a30:bf58:dc29:dc78:3014]) by rezeros.cc (OpenSMTPD) with ESMTPSA id 3a300844 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Sat, 9 Nov 2019 09:20:04 +0000 (UTC) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 7b1821eb; Sat, 9 Nov 2019 09:19:59 +0000 (UTC) From: =?utf-8?b?5a6L5paH5q2m?= Date: Sat, 9 Nov 2019 17:19:54 +0800 Message-Id: <20191109091956.6922-1-iyzsong@member.fsf.org> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/sphinx.scm (python-breathe): New package. --- gnu/packages/sphinx.scm | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/gnu/packages/sphinx.scm b/gnu/packages/sphinx.scm index da7492c42e..8c658c286d 100644 --- a/gnu/packages/sphinx.scm +++ b/gnu/packages/sphinx.scm @@ -541,3 +541,25 @@ and several other projects.") (define-public python2-sphinx-rtd-theme (package-with-python2 python-sphinx-rtd-theme)) + +(define-public python-breathe + (package + (name "python-breathe") + (version "4.13.1") + (source + (origin + (method url-fetch) + (uri (pypi-uri "breathe" version)) + (sha256 + (base32 + "1aw749n2ry27434qd7gr99dvsrs3x3chyi9aywmhjj1g4m2j6xf6")))) + (build-system python-build-system) + (propagated-inputs + `(("python-docutils" ,python-docutils) + ("python-six" ,python-six) + ("python-sphinx" ,python-sphinx))) + (home-page "https://github.com/michaeljones/breathe") + (synopsis "ReStructuredText and Sphinx bridge to Doxygen") + (description "This package is an extension to reStructuredText and Sphinx +to be able to read and render the Doxygen xml output.") + (license license:bsd-3))) From patchwork Sat Nov 9 09:19:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5a6L5paH5q2m?= X-Patchwork-Id: 16059 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 6CF56176B6; Sat, 9 Nov 2019 09:21:12 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 225FD17694 for ; Sat, 9 Nov 2019 09:21:12 +0000 (GMT) Received: from localhost ([::1]:35456 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iTMvf-0007Id-Ks for patchwork@mira.cbaines.net; Sat, 09 Nov 2019 04:21:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42631) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iTMvY-0007Gk-Ct for guix-patches@gnu.org; Sat, 09 Nov 2019 04:21:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iTMvW-0003Qi-Ta for guix-patches@gnu.org; Sat, 09 Nov 2019 04:21:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:39361) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iTMvW-0003Qd-QM for guix-patches@gnu.org; Sat, 09 Nov 2019 04:21:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iTMvW-00076s-LD for guix-patches@gnu.org; Sat, 09 Nov 2019 04:21:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#38145] [PATCH 2/3] gnu: Add knot-resolver. Resent-From: =?utf-8?b?5a6L5paH5q2m?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 09 Nov 2019 09:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38145 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 38145@debbugs.gnu.org Cc: =?utf-8?b?5a6L5paH5q2m?= Received: via spool by 38145-submit@debbugs.gnu.org id=B38145.157329121827219 (code B ref 38145); Sat, 09 Nov 2019 09:21:02 +0000 Received: (at 38145) by debbugs.gnu.org; 9 Nov 2019 09:20:18 +0000 Received: from localhost ([127.0.0.1]:48175 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iTMuo-00074s-FW for submit@debbugs.gnu.org; Sat, 09 Nov 2019 04:20:18 -0500 Received: from rezeros.cc ([45.76.207.221]:48234) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iTMuj-00074H-Rj for 38145@debbugs.gnu.org; Sat, 09 Nov 2019 04:20:14 -0500 Received: from localhost (2409:8a62:377:8a30:bf58:dc29:dc78:3014 [IPv6:2409:8a62:377:8a30:bf58:dc29:dc78:3014]) by rezeros.cc (OpenSMTPD) with ESMTPSA id 11289f10 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Sat, 9 Nov 2019 09:20:07 +0000 (UTC) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 070b5ade; Sat, 9 Nov 2019 09:19:59 +0000 (UTC) From: =?utf-8?b?5a6L5paH5q2m?= Date: Sat, 9 Nov 2019 17:19:55 +0800 Message-Id: <20191109091956.6922-2-iyzsong@member.fsf.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20191109091956.6922-1-iyzsong@member.fsf.org> References: <20191109091956.6922-1-iyzsong@member.fsf.org> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/dns.scm (knot-resolver): New package. --- gnu/packages/dns.scm | 72 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/gnu/packages/dns.scm b/gnu/packages/dns.scm index ec4008bf19..8be7205fa1 100644 --- a/gnu/packages/dns.scm +++ b/gnu/packages/dns.scm @@ -34,7 +34,9 @@ #:use-module (gnu packages autotools) #:use-module (gnu packages base) #:use-module (gnu packages bash) + #:use-module (gnu packages check) #:use-module (gnu packages databases) + #:use-module (gnu packages documentation) #:use-module (gnu packages compression) #:use-module (gnu packages crypto) #:use-module (gnu packages datastructures) @@ -46,6 +48,7 @@ #:use-module (gnu packages libevent) #:use-module (gnu packages libidn) #:use-module (gnu packages linux) + #:use-module (gnu packages lua) #:use-module (gnu packages ncurses) #:use-module (gnu packages nettle) #:use-module (gnu packages networking) @@ -54,6 +57,7 @@ #:use-module (gnu packages protobuf) #:use-module (gnu packages python) #:use-module (gnu packages python-xyz) + #:use-module (gnu packages sphinx) #:use-module (gnu packages swig) #:use-module (gnu packages tls) #:use-module (gnu packages web) @@ -65,6 +69,7 @@ #:use-module (guix git-download) #:use-module (guix utils) #:use-module (guix build-system gnu) + #:use-module (guix build-system meson) #:use-module (guix build-system trivial)) (define-public dnsmasq @@ -662,6 +667,73 @@ synthesis, and on-the-fly re-configuration.") license:public-domain ; src/contrib/fnv and possibly murmurhash3 license:gpl3+)))) ; everything else +(define-public knot-resolver + (package + (name "knot-resolver") + (version "4.2.2") + (source (origin + (method url-fetch) + (uri (string-append "https://secure.nic.cz/files/knot-resolver/" + "knot-resolver-" version ".tar.xz")) + (sha256 + (base32 + "0n0llpclhparq9wbcrymxkl5d03c4y4p3shcbdxfv6j22vzqvdh3")))) + (build-system meson-build-system) + (arguments + '(#:configure-flags + ;; We'll manage the DNS root data ourself. + '("-Dmanaged_ta=disabled") + #:phases + (modify-phases %standard-phases + (add-after 'build 'build-doc + (lambda _ + (invoke "ninja" "doc"))) + (add-after 'install 'wrap-binary + (lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (lua-* (map cdr (filter + (lambda (input) + (string-prefix? "lua-" (car input))) + inputs))) + (lua-path (lambda (p) + (string-append p "/share/lua/5.1/?.lua"))) + (lua-cpath (lambda (p) + (string-append p "/lib/lua/5.1/?.so")))) + (wrap-program (string-append out "/sbin/kresd") + `("LUA_PATH" ";" prefix ,(map lua-path lua-*)) + `("LUA_CPATH" ";" prefix ,(map lua-cpath lua-*))) + #t)))))) + (native-inputs + `(("cmocka" ,cmocka) ; for unit tests + ("doxygen" ,doxygen) + ("protobuf-c" ,protobuf-c) + ("pkg-config" ,pkg-config) + ("python-breathe" ,python-breathe) + ("python-sphinx" ,python-sphinx) + ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme))) + (inputs + `(("fstrm" ,fstrm) + ("gnutls" ,gnutls) + ("knot" ,knot) + ("libuv" ,libuv) + ("lmdb" ,lmdb) + ("luajit" ,luajit) + ;; TODO: Add optional lua modules: basexx, cqueues and psl. + ("lua-bitop" ,lua5.1-bitop) + ("lua-filesystem" ,lua5.1-filesystem) + ("lua-sec" ,lua5.1-sec) + ("lua-socket" ,lua5.1-socket))) + (home-page "https://www.knot-resolver.cz/") + (synopsis "Caching validating DNS resolver") + (description + "Knot Resolver is a caching full resolver implementation written in C and +LuaJIT, both a resolver library and a daemon.") + (license (list license:gpl3+ + ;; Some 'contrib' files are under MIT, CC0 and LGPL2. + license:expat + license:cc0 + license:lgpl2.0)))) + (define-public ddclient (package (name "ddclient") From patchwork Sat Nov 9 09:19:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5a6L5paH5q2m?= X-Patchwork-Id: 16061 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 0D642176B6; Sat, 9 Nov 2019 09:21:25 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id B109717694 for ; Sat, 9 Nov 2019 09:21:24 +0000 (GMT) Received: from localhost ([::1]:35460 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iTMvs-0007dx-A2 for patchwork@mira.cbaines.net; Sat, 09 Nov 2019 04:21:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42636) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iTMvZ-0007Gl-0A for guix-patches@gnu.org; Sat, 09 Nov 2019 04:21:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iTMvX-0003R3-DZ for guix-patches@gnu.org; Sat, 09 Nov 2019 04:21:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:39362) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iTMvX-0003Qw-AV for guix-patches@gnu.org; Sat, 09 Nov 2019 04:21:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iTMvX-000770-56 for guix-patches@gnu.org; Sat, 09 Nov 2019 04:21:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#38145] [PATCH 3/3] services: Add knot-resolver-service-type. Resent-From: =?utf-8?b?5a6L5paH5q2m?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 09 Nov 2019 09:21:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38145 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 38145@debbugs.gnu.org Cc: =?utf-8?b?5a6L5paH5q2m?= Received: via spool by 38145-submit@debbugs.gnu.org id=B38145.157329122027227 (code B ref 38145); Sat, 09 Nov 2019 09:21:03 +0000 Received: (at 38145) by debbugs.gnu.org; 9 Nov 2019 09:20:20 +0000 Received: from localhost ([127.0.0.1]:48177 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iTMup-000755-SL for submit@debbugs.gnu.org; Sat, 09 Nov 2019 04:20:20 -0500 Received: from rezeros.cc ([45.76.207.221]:48234) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iTMul-00074H-Fo for 38145@debbugs.gnu.org; Sat, 09 Nov 2019 04:20:16 -0500 Received: from localhost (2409:8a62:377:8a30:bf58:dc29:dc78:3014 [IPv6:2409:8a62:377:8a30:bf58:dc29:dc78:3014]) by rezeros.cc (OpenSMTPD) with ESMTPSA id 199c68f9 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Sat, 9 Nov 2019 09:20:10 +0000 (UTC) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id f69c9c8f; Sat, 9 Nov 2019 09:19:59 +0000 (UTC) From: =?utf-8?b?5a6L5paH5q2m?= Date: Sat, 9 Nov 2019 17:19:56 +0800 Message-Id: <20191109091956.6922-3-iyzsong@member.fsf.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20191109091956.6922-1-iyzsong@member.fsf.org> References: <20191109091956.6922-1-iyzsong@member.fsf.org> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/services/dns.scm (): New record type. (knot-resolver-activation, knot-resolver-shpherd-services): New procedures. (%knot-resolver-accounts, %kresd.conf, knot-resolver-service-type): New variables. * doc/guix.texi (DNS Services): Document it. --- doc/guix.texi | 38 ++++++++++++++++++++ gnu/services/dns.scm | 86 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 124 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index 27cb31dde5..5ad259c46e 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -21085,6 +21085,44 @@ The list of knot-zone-configuration used by this configuration. @end table @end deftp +@subsubheading Knot Resolver Service + +@deffn {Scheme Variable} knot-resolver-service-type +This this the type of the knot resolver service, whose value should be +an @code{knot-resolver-configuration} object as in this example: + +@lisp +(service knot-resolver-service-type + (knot-resolver-configuration + (kresd-config-file (plain-file "kresd.conf" " +net.listen('192.168.0.1', 5353) +user('knot-resolver', 'knot-resolver') +modules = @{ 'hints > iterate', 'stats', 'predict' @} +cache.size = 100 * MB +")))) +@end lisp + +For more information, refer its @url{https://knot-resolver.readthedocs.org/en/stable/daemon.html#configuration, manual}. +@end deffn + +@deftp {Data Type} knot-resolver-configuration +Data type representing the configuration of knot-resolver. + +@table @asis +@item @code{package} (default: @var{knot-resolver}) +Package object of the knot DNS resolver. + +@item @code{kresd-config-file} (default: %kresd.conf) +File-like object of the kresd configuration file to use, by default it +will listen on @code{127.0.0.1} and @code{::1}. + +@item @code{garbage-collection-interval} (default: 1000) +Number of milliseconds for @code{kres-cache-gc} to periodically trim the cache. + +@end table +@end deftp + + @subsubheading Dnsmasq Service @deffn {Scheme Variable} dnsmasq-service-type diff --git a/gnu/services/dns.scm b/gnu/services/dns.scm index 5f37cb0782..43b6261c07 100644 --- a/gnu/services/dns.scm +++ b/gnu/services/dns.scm @@ -45,6 +45,9 @@ zone-file zone-entry + knot-resolver-service-type + knot-resolver-configuration + dnsmasq-service-type dnsmasq-configuration @@ -638,6 +641,89 @@ (const %knot-accounts)))))) +;;; +;;; Knot Resolver. +;;; + +(define-record-type* + knot-resolver-configuration + make-knot-resolver-configuration + knot-resolver-configuration? + (package knot-resolver-configuration-package + (default knot-resolver)) + (kresd-config-file knot-resolver-kresd-config-file + (default %kresd.conf)) + (garbage-collection-interval knot-resolver-garbage-collection-interval + (default 1000))) + +(define %kresd.conf + (plain-file "kresd.conf" "-- -*- mode: lua -*- +net = { '127.0.0.1', '::1' } +user('knot-resolver', 'knot-resolver') +modules = { 'hints > iterate', 'stats', 'predict' } +cache.size = 100 * MB +")) + +(define %knot-resolver-accounts + (list (user-group + (name "knot-resolver") + (system? #t)) + (user-account + (name "knot-resolver") + (group "knot-resolver") + (system? #t) + (home-directory "/var/cache/knot-resolver") + (shell (file-append shadow "/sbin/nologin"))))) + +(define (knot-resolver-activation config) + #~(begin + (use-modules (guix build utils)) + (let ((rundir "/var/cache/knot-resolver") + (owner (getpwnam "knot-resolver"))) + (mkdir-p rundir) + (chown rundir (passwd:uid owner) (passwd:gid owner))))) + +(define knot-resolver-shepherd-services + (match-lambda + (($ package + kresd-config-file + garbage-collection-interval) + (list + (shepherd-service + (provision '(kresd)) + (requirement '(networking)) + (documentation "Run the Knot Resolver daemon.") + (start #~(make-forkexec-constructor + '(#$(file-append package "/sbin/kresd") + "-c" #$kresd-config-file "-f" "1" + "/var/cache/knot-resolver"))) + (stop #~(make-kill-destructor))) + (shepherd-service + (provision '(kres-cache-gc)) + (requirement '(user-processes)) + (documentation "Run the Knot Resolver Garbage Collector daemon.") + (start #~(make-forkexec-constructor + '(#$(file-append package "/sbin/kres-cache-gc") + "-d" #$(number->string garbage-collection-interval) + "-c" "/var/cache/knot-resolver") + #:user "knot-resolver" + #:group "knot-resolver")) + (stop #~(make-kill-destructor))))))) + +(define knot-resolver-service-type + (service-type + (name 'knot-resolver) + (extensions + (list (service-extension shepherd-root-service-type + knot-resolver-shepherd-services) + (service-extension activation-service-type + knot-resolver-activation) + (service-extension account-service-type + (const %knot-resolver-accounts)))) + (default-value (knot-resolver-configuration)) + (description "Run the Knot DNS Resolver."))) + + ;;; ;;; Dnsmasq. ;;;