Subject: [bug#58174] [PATCH 1/3] gnu: Add ocaml-domain-name.

From: raingloom <[email-masked]>
Date: Thu, 29 Sep 2022 18:47:16 +0200

gnu/packages/ocaml-mirage.scm: New file.
gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
---
 gnu/local.mk                  |  1 +
 gnu/packages/ocaml-mirage.scm | 56 +++++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+)
 create mode 100644 gnu/packages/ocaml-mirage.scm

diff --git a/gnu/local.mk b/gnu/local.mk
index 0134fb53d8..2d2e8a3a6f 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -449,6 +449,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/packages/nutrition.scm			\
   %D%/packages/nvi.scm				\
   %D%/packages/ocaml.scm			\
+  %D%/packages/ocaml-mirage.scm			\
   %D%/packages/ocr.scm				\
   %D%/packages/openkinect.scm			\
   %D%/packages/onc-rpc.scm			\
diff --git a/gnu/packages/ocaml-mirage.scm b/gnu/packages/ocaml-mirage.scm
new file mode 100644
index 0000000000..67514c4932
--- /dev/null
+++ b/gnu/packages/ocaml-mirage.scm
@@ -0,0 +1,56 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2022 Csepp <[email-masked]>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages ocaml-mirage)
+  #:use-module (guix packages)
+  #:use-module (guix download)
+  #:use-module (guix git-download)
+  #:use-module (guix build-system dune)
+  #:use-module (gnu packages ocaml)
+  #:use-module ((guix licenses)
+                #:prefix license:))
+
+(define-public ocaml-domain-name
+  (package
+    (name "ocaml-domain-name")
+    (version "0.4.0")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/hannesm/domain-name/")
+                    (commit (string-append "v" version))))
+              (file-name name)
+              (sha256
+               (base32
+                "1a669zz1pc7sqbi1c13jsnp8algcph2b8gr5fjrjhyh3p232770k"))))
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda* (#:key tests? #:allow-other-keys)
+             (when tests?
+               ;; TODO -j ncpu equivalent
+               (invoke "dune" "runtest" "-p" "domain-name")))))))
+    (build-system dune-build-system)
+    (native-inputs (list ocaml-alcotest))
+    (home-page "https://github.com/hannesm/domain-name")
+    (synopsis "RFC 1035 Internet domain name data structure and parser")
+    (description
+     "Parses and constructs RFC compliant domain names.  The invariants on the
+length of domain names are preserved throughout the module.")
+    (license license:isc)))
-- 
2.37.3