Nerves.TargetTuple (nerves v2.0.0-pre.2)

Copy Markdown View Source

Utilities for figuring out compilation target tuples

Fun rant: https://mcyoung.xyz/2025/04/14/target-triples/

Standardizing on target tuple contents is hard so this module exists to convert tuples to whatever gets the job done. The pain is intended to be here, so that workarounds don't propagate everywhere.

Summary

Types

t()

Target tuple

Functions

Convert a target tuple back to it's :erlang.system_info(:system_architecture) form

Convert a host tuple into the tuple format used by Nerves v1 toolchain artifacts

Types

t()

@type t() :: %Nerves.TargetTuple{
  abi: nil | String.t(),
  arch: String.t(),
  os: String.t(),
  vendor: String.t()
}

Target tuple

This contains the parsed :erlang.system_info(:system_architecture) results and is used for conversion to other formats.

Functions

host_string(tuple)

@spec host_string(t()) :: String.t()

Convert a target tuple back to it's :erlang.system_info(:system_architecture) form

new(system_architecture \\ :erlang.system_info(:system_architecture))

@spec new(String.t() | charlist()) :: t()

Create a new tuple

If an argument isn't passed, the host is queried.

to_nerves_v1_host_tuple(arg1)

@spec to_nerves_v1_host_tuple(t()) :: String.t() | :error

Convert a host tuple into the tuple format used by Nerves v1 toolchain artifacts