Skip to content

buildGleam

the buildGleam function produces a derivation that compiles a gleam project, and outputs the compiled code and static assets for that project.

required arguments:

  • name: the derivation’s name
  • version: the derivation’s version
  • src: the location of the project source code. must be the root directory of a gleam project (ie. contains a gleam.toml and manifest.toml)

optional arguments:

  • target: the compilation target language, either erlang (default) or javascript
  • beamDeps: a list of derivations containing compiled dependencies of this project
  • erlang: the erlang derivation to be used as the application runtime. defaults to erlang in nixpkgs
  • gleam: the gleam derivation used to compile your project. defaults to gleam in nixpkgs
  • gleam-tool: the gleam-tool derivation used during the build. defaults to the one included in gleam2nix

any extra arguments not listed here will be passed to the underlying stdenv.mkDerivation call.

the built derivation contains the compiled code and support files under the following directory, based on the provided target:

  • erlang: /lib/erlang/lib/<name>-<version>
  • javascript: /<name>