From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Craven Subject: [PATCH 4/7] gnu: Add idris-lightyear. Date: Mon, 2 Jan 2017 18:19:55 +0100 Message-ID: <20170102171958.32131-4-david@craven.ch> References: <20170102171958.32131-1-david@craven.ch> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60235) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cO6HV-0007Zs-CL for guix-devel@gnu.org; Mon, 02 Jan 2017 12:20:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cO6HP-000823-MO for guix-devel@gnu.org; Mon, 02 Jan 2017 12:20:21 -0500 Received: from so254-10.mailgun.net ([198.61.254.10]:50770) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cO6HP-0007zL-Hn for guix-devel@gnu.org; Mon, 02 Jan 2017 12:20:15 -0500 In-Reply-To: <20170102171958.32131-1-david@craven.ch> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org * gnu/packages/haskell.scm (idris-lightyear, idris-default-arguments): New variables. --- gnu/packages/haskell.scm | 71 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/gnu/packages/haskell.scm b/gnu/packages/haskell.scm index c55386e2f..2e31c0dbb 100644 --- a/gnu/packages/haskell.scm +++ b/gnu/packages/haskell.scm @@ -48,6 +48,7 @@ #:use-module (guix build-system gnu) #:use-module (guix build-system haskell) #:use-module (guix download) + #:use-module (guix git-download) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (guix utils) @@ -6751,6 +6752,76 @@ can be specified precisely in the type. The language is closely related to Epigram and Agda.") (license license:bsd-3))) +;; Idris modules use the gnu-build-system so that the IDRIS_LIBRARY_PATH is set. +(define (idris-default-arguments name) + `(#:modules ((guix build gnu-build-system) + (guix build utils) + (ice-9 ftw) + (ice-9 match)) + #:phases + (modify-phases %standard-phases + (delete 'configure) + (delete 'build) + (delete 'check) + (replace 'install + (lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (idris (assoc-ref inputs "idris")) + (idris-bin (string-append idris "/bin/idris")) + (idris-libs (string-append idris "/lib/idris/libs")) + (module-name (and (string-prefix? "idris-" ,name) + (substring ,name 6))) + (ibcsubdir (string-append out "/lib/idris/" module-name)) + (ipkg (string-append module-name ".ipkg")) + (idris-library-path (getenv "IDRIS_LIBRARY_PATH")) + (idris-path (string-split idris-library-path #\:)) + (idris-path-files (apply append + (map (lambda (path) + (map (lambda (dir) + (string-append path "/" dir)) + (scandir path))) idris-path))) + (idris-path-subdirs (filter (lambda (path) + (and path (match (stat:type (stat path)) + ('directory #t) + (_ #f)))) + idris-path-files)) + (install-cmd (cons* idris-bin + "--ibcsubdir" ibcsubdir + "--install" ipkg + (apply append (map (lambda (path) + (list "--idrispath" + path)) + idris-path-subdirs))))) + (setenv "IDRIS_LIBRARY_PATH" idris-libs) + ;; FIXME: Seems to be a bug in idris that causes a dubious failure. + (apply system* install-cmd) + #t)))))) + +(define-public idris-lightyear + (let ((commit "6d65ad111b4bed2bc131396f8385528fc6b3678a")) + (package + (name "idris-lightyear") + (version (git-version "0.1" "1" commit)) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/ziman/lightyear") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1pkxnn3ryr0v0cin4nasw7kgkc9dnnpja1nfbj466mf3qv5s98af")))) + (build-system gnu-build-system) + (native-inputs + `(("idris" ,idris))) + (arguments (idris-default-arguments name)) + (home-page "https://github.com/ziman/lightyear") + (synopsis "Lightweight parser combinator library for Idris") + (description "Lightweight parser combinator library for Idris, inspired +by Parsec. This package is used (almost) the same way as Parsec, except for one +difference: backtracking.") + (license license:bsd-2)))) + (define-public ghc-base16-bytestring (package (name "ghc-base16-bytestring") -- 2.11.0