summary refs log tree commit diff
diff options
context:
space:
mode:
authorBrian Leung <bkleung89@gmail.com>2019-06-22 23:47:32 +0200
committerTimothy Sample <samplet@ngyro.com>2019-07-19 23:09:50 -0400
commit64b7c06e188c7d5a05a5d726eba0cf46698cb78e (patch)
treedec091aa54291b81bf71585a84da2cfd7c459a7b
parent697cae2a67ae65ed7e14bf3cdf1e76d4c7579639 (diff)
downloadguix-64b7c06e188c7d5a05a5d726eba0cf46698cb78e.tar.gz
gnu: Add ghc-hindent.
* gnu/packages/haskell.scm (ghc-hindent): New variable.
-rw-r--r--gnu/packages/haskell.scm60
1 files changed, 60 insertions, 0 deletions
diff --git a/gnu/packages/haskell.scm b/gnu/packages/haskell.scm
index c7056a262a..2e845d0e93 100644
--- a/gnu/packages/haskell.scm
+++ b/gnu/packages/haskell.scm
@@ -42,6 +42,7 @@
   #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages elf)
+  #:use-module (gnu packages emacs)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages ghostscript)
   #:use-module (gnu packages gl)
@@ -11727,6 +11728,65 @@ recursive scanning and copying of directories, working with temporary
 files/directories, and more.")
     (license license:bsd-3)))
 
+(define-public ghc-hindent
+  (package
+    (name "ghc-hindent")
+    (version "5.3.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "https://hackage.haskell.org/package/hindent/hindent-"
+             version
+             ".tar.gz"))
+       (sha256
+        (base32
+         "0wkfik7mvqskk23kyh7ybgnlh3j9j1ym7d3ncahsbli9w654b7xg"))))
+    (build-system haskell-build-system)
+    (arguments
+     `(#:modules ((guix build haskell-build-system)
+                  (guix build utils)
+                  (guix build emacs-utils))
+       #:imported-modules (,@%haskell-build-system-modules
+                           (guix build emacs-utils))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'emacs-install
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((out   (assoc-ref outputs "out"))
+                    (elisp-file "elisp/hindent.el")
+                    (dest  (string-append out "/share/emacs/site-lisp"
+                                          "/guix.d/hindent-" ,version))
+                    (emacs (string-append (assoc-ref inputs "emacs")
+                                          "/bin/emacs")))
+               (make-file-writable elisp-file)
+               (emacs-substitute-variables elisp-file
+                 ("hindent-process-path"
+                  (string-append out "/bin/hindent")))
+               (install-file elisp-file dest)
+               (emacs-generate-autoloads "hindent" dest)))))))
+    (inputs
+     `(("ghc-haskell-src-exts" ,ghc-haskell-src-exts)
+       ("ghc-monad-loops" ,ghc-monad-loops)
+       ("ghc-utf8-string" ,ghc-utf8-string)
+       ("ghc-exceptions" ,ghc-exceptions)
+       ("ghc-yaml" ,ghc-yaml)
+       ("ghc-unix-compat" ,ghc-unix-compat)
+       ("ghc-path" ,ghc-path)
+       ("ghc-path-io" ,ghc-path-io)
+       ("ghc-optparse-applicative" ,ghc-optparse-applicative)))
+    (native-inputs
+     `(("ghc-hspec" ,ghc-hspec)
+       ("ghc-diff" ,ghc-diff)
+       ("emacs" ,emacs-minimal)))
+    (home-page
+     "https://github.com/commercialhaskell/hindent")
+    (synopsis "Extensible Haskell pretty printer")
+    (description
+     "This package provides automatic formatting for Haskell files.  Both a
+library and an executable.")
+    (license license:bsd-3)))
+
 (define-public ghc-descriptive
   (package
     (name "ghc-descriptive")