1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2019 Robert Vollmert <rob@vllmrt.net>
3 ;;; Copyright © 2022 Philip McGrath <philip@philipmcgrath.com>
4 ;;; Copyright © 2022 jgart <jgart@dismail.de>
6 ;;; This file is part of GNU Guix.
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21 (define-module (gnu packages elm)
22 #:use-module (gnu packages)
23 #:use-module (gnu packages haskell)
24 #:use-module (gnu packages haskell-check)
25 #:use-module (gnu packages haskell-crypto)
26 #:use-module (gnu packages haskell-xyz)
27 #:use-module (gnu packages haskell-web)
28 #:use-module (guix build-system haskell)
29 #:use-module (guix build-system elm)
30 #:use-module (guix gexp)
31 #:use-module (guix git-download)
32 #:use-module ((guix licenses) #:prefix license:)
33 #:use-module (guix packages))
35 ;; The `elm` build usually calls out to itself via Template Haskell to compile
36 ;; the `elm reactor` web app (which depends on additional Elm packages) and
37 ;; embeds the static files into itself. The reactor isn't required to compile
38 ;; Elm applications, so we want to skip it for the bootstrap package, but we
39 ;; also want to be able to enable it once we can build it. We patch Elm to
40 ;; instead look for the files on disk relative to the executable and to have
41 ;; `elm reactor` exit with a useful error message if they aren't there.
42 (define %reactor-root-base
44 (define-public elm-sans-reactor
46 (name "elm-sans-reactor")
51 (file-name (git-file-name name version))
53 (url "https://github.com/elm/compiler/")
56 (base32 "1rdg3xp3js9xadclk3cdypkscm5wahgsfmm4ldcw3xswzhw6ri8w"))
58 (search-patches "elm-reactor-static-files.patch"
59 "elm-offline-package-registry.patch"))))
60 (build-system haskell-build-system)
64 #~(list (string-append "--ghc-option=-DGUIX_REACTOR_STATIC_REL_ROOT="
65 "\"../" #$%reactor-root-base
66 #$(package-version this-package)
69 #~(modify-phases %standard-phases
70 (add-before 'configure 'update-constraints
72 (substitute* "elm.cabal"
73 (("(ansi-terminal|containers|network|http-client|language-glsl)\\s+[^,]+" all dep)
76 (list ghc-ansi-terminal
92 ghc-unordered-containers
96 (home-page "https://elm-lang.org")
97 (synopsis "Minimal variant of @command{elm}")
99 "This package provides a version of the Elm compiler without support for
100 the @command{elm reactor} development command.")
101 (license license:bsd-3)))
106 (version (package-version elm-sans-reactor))
107 (source (package-source elm-sans-reactor))
108 (native-inputs (list elm-sans-reactor))
109 (inputs (list elm-sans-reactor
115 elm-project-metadata-utils
117 elm-explorations-markdown))
118 (build-system elm-build-system)
123 ,@%elm-default-modules)
125 #~(modify-phases %standard-phases
128 (lambda* (#:key native-inputs inputs #:allow-other-keys)
129 (with-directory-excursion "reactor"
130 (patch-application-dependencies))))
132 (lambda* (#:key native-inputs inputs #:allow-other-keys)
133 (with-directory-excursion "reactor"
134 (invoke (search-input-file (or native-inputs inputs)
142 (lambda* (#:key inputs #:allow-other-keys)
143 (let* ((out-dir #$output)
144 (bin-dir (string-append out-dir "/bin"))
145 (reactor-dir (string-append out-dir
148 (getenv "GUIX_ELM_VERSION")))
149 (reactor-subdir (string-append reactor-dir "/_elm")))
150 ;; We can't use a symlink here because Haskell's
151 ;; `getExecutablePath` follows all symlinks.
152 ;; Guix can make it a hard link later.
153 (install-file (search-input-file inputs ;; NOT native-inputs
156 (install-file "reactor/assets/favicon.ico" reactor-dir)
157 (for-each (cut install-file <> reactor-subdir)
159 "reactor/assets/styles.css"
160 ;; TODO: these are source-code-pro v1.017 and
161 ;; source-sans-pro v1.050: there may be breaking
162 ;; changes in Guix's existing
163 ;; font-adobe-source-{code,sans}-pro packages
164 "reactor/assets/source-code-pro.ttf"
165 "reactor/assets/source-sans-pro.ttf")))))
166 (delete 'validate-compiled))))
167 (home-page "https://elm-lang.org")
168 (synopsis "Programming language for Web applications")
170 "Elm is a statically-typed, purely-functional programming language for
171 the browser. The @command{elm} exectable includes commands for developers
172 such as @command{elm make} and @command{elm repl}.")
173 (license license:bsd-3)))
175 ;; The 'elm' package used to be called 'elm-compiler'.
176 (define-public elm-compiler
177 (deprecated-package "elm-compiler" elm))
179 (define-public elm-core
187 (base32 "0g3xbi8f9k5q45s95nx3jfvzwdf4b2n63a52wr4027d2xjx0pmvl")))
188 (build-system elm-build-system)
189 (inputs (list elm-json-bootstrap))
191 (list #:implicit-elm-package-inputs? #f))
192 (home-page "https://package.elm-lang.org/packages/elm/core/1.0.5")
193 (synopsis "Elm's standard libraries")
194 (description "Every Elm project needs this package!")
195 (license license:bsd-3)))
197 (define-public elm-json
205 (base32 "1hx986yqw1v2bpkrh6brszl8n8awwg1s8zi7v5qg0p1rqwvjlicz")))
206 (build-system elm-build-system)
207 (propagated-inputs (list elm-core))
209 (list #:implicit-elm-package-inputs? #f))
210 (home-page "https://package.elm-lang.org/packages/elm/json/1.1.3")
211 (synopsis "Encode and decode JSON values in Elm")
213 "This package helps you convert between Elm values and JSON values.")
214 (license license:bsd-3)))
216 (define-public elm-json-bootstrap
217 ;; elm/core doesn't depend on elm/json,
218 ;; but elm-build-system's strategy for building it
219 ;; (and everything else) does
223 (name "elm-json-bootstrap")
224 (properties '((upstream-name . "elm/json")))
225 (propagated-inputs '())
228 #~(modify-phases %standard-phases
231 (delete 'validate-compiled))
232 #:implicit-elm-package-inputs? #f)))))
234 (define-public elm-virtual-dom
236 (name "elm-virtual-dom")
242 (base32 "1bjyyws7l0qvgp4ixzaimwriq86ncx5bvrzaksvjx3pv7bmkbx69")))
243 (build-system elm-build-system)
244 (propagated-inputs (list elm-json elm-core))
245 (home-page "https://package.elm-lang.org/packages/elm/virtual-dom/1.0.2")
247 "Elm's low-level virtual DOM implementation")
249 "This package provides a virtual DOM implementation that backs Elm's
250 core libraries for HTML and SVG. You should almost certainly use those
251 higher-level libraries directly.")
252 (properties '((upstream-name . "elm/virtual-dom")))
253 (license license:bsd-3)))
255 (define-public elm-html
263 (base32 "15k1679ja57vvlpinpv06znmrxy09lbhzfkzdc89i01qa8c4gb4a")))
264 (build-system elm-build-system)
266 (list elm-virtual-dom
269 (home-page "https://package.elm-lang.org/packages/elm/html/1.0.0")
270 (synopsis "Fast HTML, rendered with virtual DOM diffing")
271 (description "This package provides Elm's HTML rendering library.")
272 (license license:bsd-3)))
274 (define-public elm-svg
282 (base32 "1iqsc3p129j56lp1y3z3mfc6x1shvrmx3pkhri2777ylhyw90qvl")))
283 (build-system elm-build-system)
289 (home-page "https://package.elm-lang.org/packages/elm/svg/1.0.1")
290 (synopsis "Fast SVG, rendered with virtual DOM diffing")
292 "This package provides Elm's @acronym{SVG, Scalable Vector Graphics}
294 (license license:bsd-3)))
296 (define-public elm-time
304 (base32 "0wqa2vhl1zf8z0j2yd3yjwfhr0dydfns43bbzll3k4rhnjadxr1l")))
305 (build-system elm-build-system)
306 (propagated-inputs (list elm-core))
307 (home-page "https://package.elm-lang.org/packages/elm/time/1.0.0")
309 "POSIX time and time zones in Elm")
311 "This package provides an Elm library for working with POSIX times, time
312 zones, formatting, and the clock.")
313 (license license:bsd-3)))
315 (define-public elm-url
323 (base32 "1f2ij4i7zmijnj2i50qf19lpkr14bhms8dkq029inb5mydi9f8gs")))
324 (build-system elm-build-system)
325 (propagated-inputs (list elm-core))
326 (home-page "https://package.elm-lang.org/packages/elm/url/1.0.0")
328 "Create and parse URLs in Elm")
330 "This package helps you:
337 parse existing URLs into nice Elm data structures.
340 Use it for HTTP and for @dfn{routing} in @acronym{SPAs, single-page apps}.")
341 (license license:bsd-3)))
343 (define-public elm-browser
351 (base32 "0863nw2hhbpm3s03lm1imi5x28wwknzrwg2p79s5mydgvdvgwjf0")))
352 (build-system elm-build-system)
354 (list elm-virtual-dom
360 (home-page "https://package.elm-lang.org/packages/elm/browser/1.0.2")
362 "Run Elm in browsers")
364 "This package allows you to create Elm programs that run in browsers,
365 with access to browser history for @acronym{SPAs, single-page apps}.")
366 (license license:bsd-3)))
368 (define-public elm-bytes
376 (base32 "0n411j2cyz9m241q6vszfzpq3fraradwal5m0gigp2505mdfpz3x")))
377 (build-system elm-build-system)
378 (propagated-inputs (list elm-core))
379 (home-page "https://package.elm-lang.org/packages/elm/bytes/1.0.8")
380 (synopsis "Work with sequences of bytes in Elm")
381 (description "This package provides an Elm library for working with
382 densely packed sequences of bytes, such as @code{ArrayBuffer}, typed arrays,
383 and @code{DataView}.")
384 (license license:bsd-3)))
386 (define-public elm-file
394 (base32 "0aimgicrdpys0v89m2wjx413561zil14cczjh6mkn9jcgckx6yng")))
395 (build-system elm-build-system)
401 (home-page "https://package.elm-lang.org/packages/elm/file/1.0.5")
402 (synopsis "Work with files in Elm")
403 (description "This package enables Elm programs to select files, download
404 files, and work with file content.")
405 (license license:bsd-3)))
407 (define-public elm-http
415 (base32 "0mfbz0lkfidmq5xpv5csw8943q0yrpvj0rwd2vb0gc8rbsfc9dg8")))
416 (build-system elm-build-system)
422 (home-page "https://package.elm-lang.org/packages/elm/http/2.0.0")
423 (synopsis "Make HTTP requests in Elm")
424 (description "This package enables Elm programs to make HTTP requests and
426 (license license:bsd-3)))
428 (define-public elm-parser
436 (base32 "06xx29rmagc5r45qfpvrd393lz83ylngidfp08432f1qc8y6r3lh")))
437 (build-system elm-build-system)
438 (propagated-inputs (list elm-core))
439 (home-page "https://package.elm-lang.org/packages/elm/parser/1.1.0")
441 "Parsing library for Elm")
443 "Regular expressions are quite confusing and difficult to use. This
444 library provides a coherent alternative that handles more cases and produces
445 clearer code. It is focused on simplicity and great error messages.")
446 (license license:bsd-3)))
448 (define-public elm-project-metadata-utils
450 (name "elm-project-metadata-utils")
454 "elm/project-metadata-utils"
456 (base32 "1wj7chfy4knwwyc3k0hy431c80hs7hc686qsr34ayn8gip73x2jj")))
457 (build-system elm-build-system)
463 "https://package.elm-lang.org/packages/elm/project-metadata-utils/1.0.2")
464 (synopsis "Work with @file{elm.json} and @file{docs.json} files in Elm")
466 "This package is meant for people creating Elm tooling, like editor
467 plugins. If you just want to make stuff in Elm, there is nothing here for
469 (properties '((upstream-name . "elm/project-metadata-utils")))
470 (license license:bsd-3)))
472 (define-public elm-explorations-markdown
474 (name "elm-explorations-markdown")
478 "elm-explorations/markdown"
480 (base32 "1f57ikdpbbhchcpwj32216gxjxijrc3sdpg27s1cgzia9pnkqk6p")))
481 (build-system elm-build-system)
482 (propagated-inputs (list elm-html elm-core))
484 "https://package.elm-lang.org/packages/elm-explorations/markdown/1.0.0")
485 (synopsis "Fast markdown parsing and rendering in Elm")
487 "This package is for markdown parsing and rendering in Elm. It is based
488 on the @code{marked} project, which focuses on speed.")
489 (license license:bsd-3)))
491 (define-public elm-community-random-extra
493 (name "elm-community-random-extra")
495 (source (elm-package-origin
496 "elm-community/random-extra" version
497 (base32 "13l48mx4wj7qdxl1shn9ij34izap256vv3k49ncnxpkjb7m1m3xk")))
498 (build-system elm-build-system)
499 (propagated-inputs (list elm-time elm-random elm-core))
500 (inputs (list elm-explorations-test))
502 "https://package.elm-lang.org/packages/elm-community/random-extra/")
503 (synopsis "Extra functions for the Elm core random library")
504 (description "@code{emacs-community-random-extra} includes lots of extra
505 helper functions for the Random module.")
506 (license license:bsd-3)))
508 (define-public elm-todomvc
509 (let ((commit "f236e7e56941c7705aba6e42cb020ff515fe3290")
513 (version (git-version "1" revision commit))
518 (url "https://github.com/evancz/elm-todomvc")
521 (base32 "0g37bglzshkf79s4n7aq9ib44h5qn8ng7n72sh2xslgd20h05nfw"))
522 (file-name (git-file-name name version))))
523 (inputs (list elm-browser elm-core elm-html elm-json))
524 (build-system elm-build-system)
529 ,@%elm-default-modules)
531 #~(modify-phases %standard-phases
534 patch-application-dependencies)
536 (lambda* (#:key native-inputs inputs #:allow-other-keys)
537 (invoke (search-input-file (or native-inputs inputs)
544 (let* ((out-dir #$output)
546 (string-append out-dir
548 (strip-store-file-name out-dir))))
549 (for-each (cut install-file <> dest-dir)
554 (delete 'validate-compiled))))
555 (home-page "https://github.com/evancz/elm-todomvc")
556 (synopsis "TodoMVC in Elm")
557 (description "This is the official Elm implementation of
558 @url{https://todomvc.com,TodoMVC}, a simple to-do--list application used to
559 compare front-end web frameworks.")
560 (license license:bsd-3))))
562 (define-public elm-debois-elm-dom
564 (name "elm-debois-elm-dom")
570 (base32 "0w4z4w6ip118lk5g80w6mbbfxhfmivbmdkdm6wsmk63x85gscmqx")))
571 (build-system elm-build-system)
573 (list elm-json elm-html elm-core))
574 (home-page "https://package.elm-lang.org/packages/debois/elm-dom/1.3.0")
575 (synopsis "DOM traversal for Elm event-handlers")
577 "This package provides a library for reading information off the DOM.
578 Use this if you need to discover geometry information (width, position, etc.)
579 of rendered elements.")
580 (license license:asl2.0)))
582 (define-public elm-random
590 (base32 "0z0znkwfs35xiabk6pa9yqwsq03jssgd7jmsj1kk000mikfm7f39")))
591 (build-system elm-build-system)
592 (propagated-inputs (list elm-time elm-core))
593 (home-page "https://package.elm-lang.org/packages/elm/random/1.0.0")
594 (synopsis "Generate random numbers and values in Elm")
596 "Need to generate random numbers? How about random game boards? Or
597 random positions in 3D space? This is the package for you!")
598 (license license:bsd-3)))
600 (define-public elm-explorations-test
602 (name "elm-explorations-test")
606 "elm-explorations/test"
608 (base32 "0kw32x0lr6nh5j9xk56vgg7x7c705g38grghh7cdp49frwdd6w3l")))
609 (build-system elm-build-system)
611 (list elm-virtual-dom
617 "https://package.elm-lang.org/packages/elm-explorations/test/1.2.2")
618 (synopsis "Testing framework for Elm")
619 (description "This package enables writing unit and fuzz tests for Elm
620 code. To actually run the tests, you need the command-line tool from
621 @url{https://github.com/rtfeldman/node-test-runner}, which has not yet been
623 (license license:bsd-3)))
625 (define-public elm-danhandrea-elm-date-format
627 (name "elm-danhandrea-elm-date-format")
631 "danhandrea/elm-date-format"
633 (base32 "03mglzyywij5sm56m7q2jhhbsv7f9rdirgwmq0q41ghir81bzpv6")))
634 (build-system elm-build-system)
635 (propagated-inputs (list elm-time elm-core))
636 (inputs (list elm-explorations-test))
638 "https://package.elm-lang.org/packages/danhandrea/elm-date-format/2.0.1")
639 (synopsis "Date formatting for Elm")
640 (description "This package enhances @code{elm/time} with support for
641 format strings and internationalization of dates.")
642 (license license:bsd-3)))
644 (define-public elm-danhandrea-elm-time-extra
646 (name "elm-danhandrea-elm-time-extra")
650 "danhandrea/elm-time-extra"
652 (base32 "0z13q8x148d5amcc89f846yzql89n9gyan8fr48y91dhhn7vxibf")))
653 (build-system elm-build-system)
654 (propagated-inputs (list elm-time elm-core))
656 (list elm-explorations-test
657 elm-danhandrea-elm-date-format))
659 "https://package.elm-lang.org/packages/danhandrea/elm-time-extra/1.1.0")
660 (synopsis "Extra utilities for POSIX time in Elm")
661 (description "This package enhances @code{elm/time} with extra utilities
662 for working with POSIX times.")
663 (license license:bsd-3)))
665 (define-public elm-justinmimbs-date
667 (name "elm-justinmimbs-date")
673 (base32 "13mf97137f0yb3gx1mxbya2y70qciah4hp5bcnpj8166vgzb7l3l")))
674 (build-system elm-build-system)
679 (home-page "https://package.elm-lang.org/packages/justinmimbs/date/4.0.1")
680 (synopsis "Work with dates without times or zones in Elm")
682 "This Elm package provides a simple @code{Date} type for working with
683 dates without times or zones.")
684 (license license:bsd-3)))
686 (define-public elm-justinmimbs-time-extra
688 (name "elm-justinmimbs-time-extra")
692 "justinmimbs/time-extra"
694 (base32 "1gmgvzlpzkysvm86d0md75ply10pz28bg699m4763frss0jvrngh")))
695 (build-system elm-build-system)
697 (list elm-justinmimbs-date
701 "https://package.elm-lang.org/packages/justinmimbs/time-extra/1.1.1")
702 (synopsis "Extra functions for POSIX times in Elm")
704 "This package provides extra functions for working with @code{Posix}
705 times from @code{elm/time}.")
706 (license license:bsd-3)))
708 (define-public elm-myrho-elm-round
710 (name "elm-myrho-elm-round")
716 (base32 "0y3j43wr815cvwz5310zalnqzpg3hw8h127zjjlf6x8ynapc2mdb")))
717 (build-system elm-build-system)
718 (propagated-inputs (list elm-core))
719 (inputs (list elm-explorations-test))
720 (home-page "https://package.elm-lang.org/packages/myrho/elm-round/1.0.4")
721 (synopsis "Flexible rounding of Elm @code{Float}s")
723 "This library converts a @code{Float} to a @code{String} with ultimate
724 control how many digits after the decimal point are shown and how the
725 remaining digits are rounded. It rounds, floors and ceils the @dfn{common}
726 way (i.e. half up) or the @dfn{commerical} way (ie. half away from zero).")
727 (license license:bsd-3)))
729 (define-public elm-ryannhg-date-format
731 (name "elm-ryannhg-date-format")
735 "ryannhg/date-format"
737 (base32 "0razh6im5qwmla10knk67j8w11mqlqlyfnclykbfl06kaksfm3sp")))
738 (build-system elm-build-system)
739 (propagated-inputs (list elm-time elm-core))
740 (inputs (list elm-explorations-test))
742 "https://package.elm-lang.org/packages/ryannhg/date-format/2.3.0")
743 (synopsis "Reliable advanced dates formatting for Elm")
745 "This package provides Elm programs with reliable, powerful tools for
746 formatting dates and times. It uses Elm's type system instead of format
747 strings, which makes formatting code more readable and can catch some errors
749 (license license:bsd-3)))
751 (define-public elm-terezka-intervals
753 (name "elm-terezka-intervals")
759 (base32 "0h3im58sa6awyppch1v8ppcrzwc5h48yn45crx98m8zs4isx91lj")))
760 (build-system elm-build-system)
762 (list elm-ryannhg-date-format
764 elm-justinmimbs-time-extra
770 elm-danhandrea-elm-time-extra))
771 (inputs (list elm-explorations-test))
772 (home-page "https://package.elm-lang.org/packages/terezka/intervals/2.0.1")
773 (synopsis "Produce nice intervals for Elm charts")
775 "This package provides an Elm library for producing nice intervals for
776 charts. It's useful in combination with @code{terezka/elm-charts}. When I
777 say ``nice'', I just mean that I try to calculate intervals which begin with
778 10, 5, 3, 2, or 1 (adjusted to magnitude, of course!). For dates, I try to
779 hit whole days, weeks, and months or hours, minutes, and seconds.")
780 (license license:bsd-3)))
782 (define-public elm-terezka-elm-charts
784 (name "elm-terezka-elm-charts")
785 (version "3.0.0") ;; NOTE! Tags like 5.1.0 are from an OLDER version.
790 (base32 "17syq73jwldc7fk7snm5k8s85nsvxyprb34rs1rwjsapc1vii7hc")))
791 (build-system elm-build-system)
793 (list elm-terezka-intervals
794 elm-ryannhg-date-format
802 "https://elm-charts.org")
803 (synopsis "SVG chart components in Elm")
805 "Make SVG charts in all Elm. The package can draw charts at a variety of
806 different levels of customization, from basic charts with standard features to
807 very custom styles. The library also allows including your very own SVG
808 elements while still easily utilizing the coordinate system calculated from
809 your data, as well as editing the SVGs made by the package. It has great
810 support for interactivity, layering different charts, and adding irregular
812 (license license:bsd-3)))