diff options
author | Philip McGrath <philip@philipmcgrath.com> | 2022-05-18 14:11:10 -0400 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2022-05-22 01:07:55 +0200 |
commit | b6c0f18dee39d0adb2b8e7019e3d7cc5be9f933d (patch) | |
tree | fb6b81565d15eabca3e26e004733feb39a9204eb | |
parent | gnu: elm: Support 'elm reactor'. (diff) | |
download | guix-b6c0f18dee39d0adb2b8e7019e3d7cc5be9f933d.tar.gz guix-b6c0f18dee39d0adb2b8e7019e3d7cc5be9f933d.tar.bz2 guix-b6c0f18dee39d0adb2b8e7019e3d7cc5be9f933d.tar.xz |
gnu: Add elm-todomvc.
* gnu/packages/elm.scm (elm-todomvc): New variable.
* doc/guix.texi (Build Systems)[elm-build-system]: Mention it.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
-rw-r--r-- | doc/guix.texi | 4 | ||||
-rw-r--r-- | gnu/packages/elm.scm | 53 |
2 files changed, 55 insertions, 2 deletions
diff --git a/doc/guix.texi b/doc/guix.texi index 27d0c69dad..9cdee15d55 100644 --- a/doc/guix.texi +++ b/doc/guix.texi | |||
@@ -8748,7 +8748,7 @@ Elm @dfn{projects} which declare @code{@{ "type": "package" @}} in their | |||
8748 | @file{elm.json} files. Using @code{elm-build-system} to build Elm | 8748 | @file{elm.json} files. Using @code{elm-build-system} to build Elm |
8749 | @dfn{applications} (which declare @code{@{ "type": "application" @}}) is | 8749 | @dfn{applications} (which declare @code{@{ "type": "application" @}}) is |
8750 | possible, but requires ad-hoc modifications to the build phases. For | 8750 | possible, but requires ad-hoc modifications to the build phases. For |
8751 | an example, see the definition of | 8751 | examples, see the definitions of the @code{elm-todomvc} example application and |
8752 | the @code{elm} package itself (because the front-end for the | 8752 | the @code{elm} package itself (because the front-end for the |
8753 | @samp{elm reactor} command is an Elm application). | 8753 | @samp{elm reactor} command is an Elm application). |
8754 | 8754 | ||
@@ -8757,7 +8757,7 @@ Elm supports multiple versions of a package coexisting simultaneously under | |||
8757 | @env{ELM_HOME}, but this does not yet work well with @code{elm-build-system}. | 8757 | @env{ELM_HOME}, but this does not yet work well with @code{elm-build-system}. |
8758 | This limitation primarily affects Elm applications, because they specify | 8758 | This limitation primarily affects Elm applications, because they specify |
8759 | exact versions for their dependencies, whereas Elm packages specify supported | 8759 | exact versions for their dependencies, whereas Elm packages specify supported |
8760 | version ranges. As a workaround, you can use | 8760 | version ranges. As a workaround, the example applications mentioned above use |
8761 | the @code{patch-application-dependencies} procedure provided by | 8761 | the @code{patch-application-dependencies} procedure provided by |
8762 | @code{(guix build elm-build-system)} to rewrite their @file{elm.json} files to | 8762 | @code{(guix build elm-build-system)} to rewrite their @file{elm.json} files to |
8763 | refer to the package versions actually present in the build environment. | 8763 | refer to the package versions actually present in the build environment. |
diff --git a/gnu/packages/elm.scm b/gnu/packages/elm.scm index d515d68e8f..9d3a58bcb5 100644 --- a/gnu/packages/elm.scm +++ b/gnu/packages/elm.scm | |||
@@ -487,3 +487,56 @@ you.") | |||
487 | on the @code{marked} project, which focuses on speed.") | 487 | on the @code{marked} project, which focuses on speed.") |
488 | (license license:bsd-3))) | 488 | (license license:bsd-3))) |
489 | 489 | ||
490 | (define-public elm-todomvc | ||
491 | (let ((commit "f236e7e56941c7705aba6e42cb020ff515fe3290") | ||
492 | (revision "1")) | ||
493 | (package | ||
494 | (name "elm-todomvc") | ||
495 | (version (git-version "1" revision commit)) | ||
496 | (source | ||
497 | (origin | ||
498 | (method git-fetch) | ||
499 | (uri (git-reference | ||
500 | (url "https://github.com/evancz/elm-todomvc") | ||
501 | (commit commit))) | ||
502 | (sha256 | ||
503 | (base32 "0g37bglzshkf79s4n7aq9ib44h5qn8ng7n72sh2xslgd20h05nfw")) | ||
504 | (file-name (git-file-name name version)))) | ||
505 | (inputs (list elm-browser elm-core elm-html elm-json)) | ||
506 | (build-system elm-build-system) | ||
507 | (arguments | ||
508 | (list | ||
509 | #:modules | ||
510 | `((srfi srfi-26) | ||
511 | ,@%elm-default-modules) | ||
512 | #:phases | ||
513 | #~(modify-phases %standard-phases | ||
514 | (delete 'stage) | ||
515 | (replace 'configure | ||
516 | patch-application-dependencies) | ||
517 | (replace 'build | ||
518 | (lambda* (#:key native-inputs inputs #:allow-other-keys) | ||
519 | (invoke (search-input-file (or native-inputs inputs) | ||
520 | "/bin/elm") | ||
521 | "make" | ||
522 | "src/Main.elm" | ||
523 | "--output=elm.js"))) | ||
524 | (replace 'install | ||
525 | (lambda args | ||
526 | (let* ((out-dir #$output) | ||
527 | (dest-dir | ||
528 | (string-append out-dir | ||
529 | "/share/" | ||
530 | (strip-store-file-name out-dir)))) | ||
531 | (for-each (cut install-file <> dest-dir) | ||
532 | `("elm.js" | ||
533 | "index.html" | ||
534 | "style.css" | ||
535 | "README.md"))))) | ||
536 | (delete 'validate-compiled)))) | ||
537 | (home-page "https://github.com/evancz/elm-todomvc") | ||
538 | (synopsis "TodoMVC in Elm") | ||
539 | (description "This is the official Elm implementation of | ||
540 | @url{https://todomvc.com,TodoMVC}, a simple to-do--list application used to | ||
541 | compare front-end web frameworks.") | ||
542 | (license license:bsd-3)))) | ||