summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorPierre Neidhardt <mail@ambrevar.xyz>2020-09-01 13:51:42 +0200
committerPierre Neidhardt <mail@ambrevar.xyz>2020-09-01 16:53:28 +0200
commitf5e31b1d3567162d834d2bb49163a199c672da5c (patch)
tree65b0c52d471d108c3e3e70cec7bfd7947a38ac2b /gnu
parent257cf3e7dbc884073a6b9180e118280da9af70f8 (diff)
downloadguix-f5e31b1d3567162d834d2bb49163a199c672da5c.tar.gz
gnu: Add mito.
* gnu/packages/lisp-xyz.scm (cl-mito, sbcl-mito): New variables.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/lisp-xyz.scm112
1 files changed, 112 insertions, 0 deletions
diff --git a/gnu/packages/lisp-xyz.scm b/gnu/packages/lisp-xyz.scm
index cfac25ec6c..f681153477 100644
--- a/gnu/packages/lisp-xyz.scm
+++ b/gnu/packages/lisp-xyz.scm
@@ -13602,3 +13602,115 @@ can separate configuration system from an implementation.")
 
 (define-public ecl-envy
   (sbcl-package->ecl-package sbcl-envy))
+
+(define sbcl-mito-core
+  (let ((commit "d3b9e375ef364a65692da2185085a08c969ac88a")
+	(revision "1"))
+    (package
+      (name "sbcl-mito-core")
+      (version (git-version "0.1" revision commit))
+      (home-page "https://github.com/fukamachi/mito")
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url home-page)
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "08mncgzjnbbsf1a6am3l73iw4lyfvz5ldjg5g84awfaxml4p73mb"))))
+      (build-system asdf-build-system/sbcl)
+      (inputs
+       `(("dbi" ,sbcl-dbi)
+         ("sxql" ,sbcl-sxql)
+         ("cl-ppcre" ,sbcl-cl-ppcre)
+         ("closer-mop" ,sbcl-closer-mop)
+         ("dissect" ,sbcl-dissect)
+         ("optima" ,sbcl-optima)
+         ("cl-reexport" ,sbcl-cl-reexport)
+         ("local-time" ,sbcl-local-time)
+         ("uuid" ,sbcl-uuid)
+         ("alexandria" ,sbcl-alexandria)))
+      (synopsis "ORM for Common Lisp with migrations and relationships support")
+      (description "Mito is yet another object relational mapper, and it aims
+to be a successor of Integral.
+
+@itemize
+@item Support MySQL, PostgreSQL and SQLite3.
+@item Add id (serial/uuid primary key), created_at and updated_at by default
+like Ruby's ActiveRecord.
+@item Migrations.
+@item Database schema versioning.
+@end itemize\n")
+      (license license:llgpl))))
+
+(define sbcl-mito-migration
+  (package
+    (inherit sbcl-mito-core)
+    (name "sbcl-mito-migration")
+    (inputs
+     `(("mito-core" ,sbcl-mito-core)
+       ("dbi" ,sbcl-dbi)
+       ("sxql" ,sbcl-sxql)
+       ("closer-mop" ,sbcl-closer-mop)
+       ("cl-reexport" ,sbcl-cl-reexport)
+       ("uuid" ,sbcl-uuid)
+       ("alexandria" ,sbcl-alexandria)
+       ("esrap" ,sbcl-esrap)))))
+
+(define sbcl-lack-middleware-mito
+  (package
+    (inherit sbcl-mito-core)
+    (name "sbcl-lack-middleware-mito")
+    (inputs
+     `(("mito-core" ,sbcl-mito-core)
+       ("dbi" ,sbcl-dbi)))
+    (arguments
+       '(#:phases
+         (modify-phases %standard-phases
+           (add-after 'unpack 'fix-build
+             (lambda _
+               (substitute* "lack-middleware-mito.asd"
+                 (("cl-dbi") "dbi"))
+               #t)))))))
+
+(define-public sbcl-mito
+  (package
+    (inherit sbcl-mito-core)
+    (name "sbcl-mito")
+    (inputs
+     `(("mito-core" ,sbcl-mito-core)
+       ("mito-migration" ,sbcl-mito-migration)
+       ("lack-middleware-mito" ,sbcl-lack-middleware-mito)
+       ("cl-reexport" ,sbcl-cl-reexport)))
+    (native-inputs
+     `(("prove" ,sbcl-prove)
+       ("prove-asdf" ,sbcl-prove-asdf)
+       ("dbd-mysql" ,sbcl-dbd-mysql)
+       ("dbd-postgres" ,sbcl-dbd-postgres)
+       ("dbd-sqlite3" ,sbcl-dbd-sqlite3)))
+    (arguments
+       '(#:phases
+         (modify-phases %standard-phases
+           (add-after 'unpack 'remove-non-functional-tests
+             (lambda _
+               (substitute* "mito-test.asd"
+                 ;; (("\\(:test-file \"migration/mysql\"\\)") "")
+                 (("\\(:test-file \"db/mysql\"\\)") "")
+                 (("\\(:test-file \"db/postgres\"\\)") "")
+                 (("\\(:test-file \"dao\"\\)") "")
+                 ;; TODO: migration/sqlite3 should work, re-enable once
+                 ;; upstream has fixed it:
+                 ;; https://github.com/fukamachi/mito/issues/70
+                 (("\\(:test-file \"migration/sqlite3\"\\)") "")
+                 (("\\(:test-file \"migration/mysql\"\\)") "")
+                 (("\\(:test-file \"migration/postgres\"\\)") "")
+                 (("\\(:test-file \"postgres-types\"\\)") "")
+                 (("\\(:test-file \"mixin\"\\)") ""))
+               #t)))
+         ;; TODO: While all enabled tests pass, the phase fails with:
+         ;; Component MITO-ASD::MITO-TEST not found, required by #<SYSTEM "mito">
+         #:tests? #f))))
+
+(define-public cl-mito
+  (sbcl-package->cl-source-package sbcl-mito))