diff --git a/glicid/packages/dns.scm b/glicid/packages/dns.scm new file mode 100644 index 0000000..8d097a4 --- /dev/null +++ b/glicid/packages/dns.scm @@ -0,0 +1,59 @@ +(define-module (glicid packages isc-bind) + #:use-module (guix build-system gnu) + #:use-module (guix download) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix packages) + #:use-module (guix utils) + #:use-module (gnu packages linux) + #:use-module (gnu packages libevent) + #:use-module (gnu packages perl) + #:use-module (gnu packages pkg-config) + #:use-module (gnu packages python) + #:use-module (gnu packages python-xyz) + #:use-module (gnu packages tls) + #:use-module (gnu packages xml) + #:use-module (glicid packages web)) + +(define-public isc-bind + (package + (name "bind") + (version "9.18.12") + (source (origin + (method url-fetch) + (uri (list (string-append "https://downloads.isc.org/isc/bind9/" version "/bind-" version ".tar.xz"))) + (sha256 (base32 "1rr7418jdi0fqckx9br78i918v3zma8b31j30nnvpak3n2vnnxj7")))) + (build-system gnu-build-system) + (outputs `("out" "utils")) + (inputs + (list libcap libuv libxml2 openssl p11-kit python `(,nghttp2 "lib") python-ply)) + (native-inputs + (list perl pkg-config)) + (arguments + `( + #:configure-flags + (list "--with-sysroot=/") + #:phases + (modify-phases %standard-phases + (add-after 'strip 'move-to-utils + (lambda _ + (for-each + (lambda (file) + (let ((target (string-append (assoc-ref %outputs "utils") file)) + (src (string-append (assoc-ref %outputs "out") file))) + (mkdir-p (dirname target)) + (link src target) + (delete-file src))) + '("/bin/dig" "/bin/delv" "/bin/nslookup" "/bin/host" "/bin/nsupdate" + "/share/man/man1/dig.1" "/share/man/man1/host.1" "/share/man/man1/nslookup.1" + "/share/man/man1/nsupdate.1")) + #t)) + (replace 'check + (lambda _ + (with-directory-excursion "fuzz" (invoke "make" "check")) + #t))))) + (synopsis "@acronym{DNS, Domain Name System} implementation") + (description "BIND implements the @acronym{DNS, Domain Name System} protocols for the Internet. check gnu/packages/dns for more") + (home-page "https://www.isc.org/bind/") + (license (list license:mpl2.0)))) + +isc-bind diff --git a/glicid/services/dns.scm b/glicid/services/dns.scm new file mode 100644 index 0000000..8e42fae --- /dev/null +++ b/glicid/services/dns.scm @@ -0,0 +1,55 @@ +(define-module (glicid services dns) + #:use-module (gnu packages dns) + #:use-module (gnu services) + #:use-module (gnu services shepherd) + #:use-module (guix) + #:use-module (guix records) + #:use-module (ice-9 match) + #: export ( + named-configuration + named-configuration? + named-shepherd-service + named-service-type + )) + +(define-record-type* + + named-configuration make-named-configuration + named-configuration? + (named-pkg named-pkg (default isc-bind)) + (config-file config-file (default (file-append named "/etc/named/named.conf"))) + (pid-file pid-file (default "/var/run/named.pid")) + (log-file log-file (default "/var/log/named.log"))) + +(define named-shepherd-service + (match-lambda + (($ named-pkg config-file pid-file log-file ) + (list + (shepherd-service + (provision '(named)) + (documentation "Run named.") + (requirement '(user-processes)) + (respawn? #t) + (start #~(make-forkexec-constructor + (list + #$(file-append named-pkg "/sbin/named") + "-f" + "-c" #$config-file + ) + #:pid-file #$pid-file + #:log-file #$log-file )) + (stop #~(make-kill-destructor))))))) + +(define %named-activation + #~(begin + (mkdir-p "/var/run/named") + (mkdir-p "/var/lib/named") + #t )) + +(define named-service-type + (service-type + (name 'named) + (extensions (list + (service-extension shepherd-root-service-type named-shepherd-service) + (service-extension activation-service-type (const %named-activation)))) + (description "Run named.")))