diff options
author | Philip McGrath <philip@philipmcgrath.com> | 2022-05-18 14:10:52 -0400 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2022-05-22 01:07:52 +0200 |
commit | dce724dc82c4ec4b55288b539e23239eb9677350 (patch) | |
tree | f23b2e4f6cd3aa0271c4e91f405b11257d3f6232 | |
parent | d16b2a1421716225c97a21442d3005d14ed87239 (diff) | |
download | guix-dce724dc82c4ec4b55288b539e23239eb9677350.tar.gz guix-dce724dc82c4ec4b55288b539e23239eb9677350.zip |
build-system/elm: Add implicit Elm inputs.
* guix/build-system/elm.scm (default-elm-core): New variable.
(default-elm-json): Likewise
(lower): Use them as implicit inputs when applicable.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
-rw-r--r-- | guix/build-system/elm.scm | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/guix/build-system/elm.scm b/guix/build-system/elm.scm index b54954bf4e..293bcbfb64 100644 --- a/guix/build-system/elm.scm +++ b/guix/build-system/elm.scm @@ -103,6 +103,18 @@ given VERSION with sha256 checksum HASH." (let ((elm (resolve-interface '(gnu packages elm)))) (module-ref elm 'elm))) +(define (default-elm-core) + "Return the default elm-core package." + ;; Lazily resolve the binding to avoid a circular dependency. + (let ((elm (resolve-interface '(gnu packages elm)))) + (module-ref elm 'elm-core))) + +(define (default-elm-json) + "Return the default elm-json package." + ;; Lazily resolve the binding to avoid a circular dependency. + (let ((elm (resolve-interface '(gnu packages elm)))) + (module-ref elm 'elm-json))) + (define* (lower name #:key source inputs native-inputs outputs system target (implicit-elm-package-inputs? #t) @@ -127,6 +139,28 @@ given VERSION with sha256 checksum HASH." '()) ,@inputs ("elm" ,elm) + ,@(cond + (implicit-elm-package-inputs? + ;; These are needed for elm-build-system even if not actually + ;; needed by the package being built. But "elm/json" is often + ;; present in practice, and "elm/core" always is: only add the + ;; default packages if no suitable inputs have been given + ;; explicitly. + (filter-map + (match-lambda + ((name get-default) + (cond + ((find (match-lambda + ((_ pkg . _) + (equal? name (guix-package->elm-name pkg)))) + inputs) + #f) + (else + `(,name ,(get-default)))))) + `(("elm/core" ,default-elm-core) + ("elm/json" ,default-elm-json)))) + (else + '())) ;; TODO: probably don't need most of (standard-packages) ,@(standard-packages))) (outputs outputs) |