Next: , Previous: , Up: 打包指导   [Contents][Index]


22.4.11 Elm Packages

Elm applications can be named like other software: their names need not mention Elm.

Packages in the Elm sense (see elm-build-system under 构建系统) are required use names of the format author/project, where both the author and the project may contain hyphens internally, and the author sometimes contains uppercase letters.

To form the Guix package name from the upstream name, we follow a convention similar to Python packages (see Python模块), adding an elm- prefix unless the name would already begin with elm-.

In many cases we can reconstruct an Elm package’s upstream name heuristically, but, since conversion to a Guix-style name involves a loss of information, this is not always possible. Care should be taken to add the 'upstream-name property when necessary so that ‘guix import elm’ will work correctly (see Invoking guix import). The most notable scenarios when explicitly specifying the upstream name is necessary are:

  1. When the author is elm and the project contains one or more hyphens, as with elm/virtual-dom; and
  2. When the author contains hyphens or uppercase letters, as with Elm-Canvas/raster-shapes—unless the author is elm-explorations, which is handled as a special case, so packages like elm-explorations/markdown do not need to use the 'upstream-name property.

The module (guix build-system elm) provides the following utilities for working with names and related conventions:

Scheme procedure: elm-package-origin elm-name version hash Returns a Git origin using the repository naming and tagging

regime required for a published Elm package with the upstream name elm-name at version version with sha256 checksum hash.

For example:

(package
  (name "elm-html")
  (version "1.0.0")
  (source
   (elm-package-origin
    "elm/html"
    version
    (base32 "15k1679ja57vvlpinpv06znmrxy09lbhzfkzdc89i01qa8c4gb4a")))
  ...)
Scheme procedure: elm->package-name elm-name

Returns the Guix-style package name for an Elm package with upstream name elm-name.

Note that there is more than one possible elm-name for which elm->package-name will produce a given result.

Scheme procedure: guix-package->elm-name package

Given an Elm package, returns the possibly-inferred upstream name, or #f the upstream name is not specified via the 'upstream-name property and can not be inferred by infer-elm-package-name.

Scheme procedure: infer-elm-package-name guix-name

Given the guix-name of an Elm package, returns the inferred upstream name, or #f if the upstream name can’t be inferred. If the result is not #f, supplying it to elm->package-name would produce guix-name.


Next: 字体, Previous: Rust Crates, Up: 打包指导   [Contents][Index]