Skip to content

RFC: TOML API #51

@nrdxp

Description

@nrdxp

The API for an atom should be relatively simple, and solve everything we need for it to solve, primarily dependency handling and high-level configuration, e.g. build variants, platforms, etc

Here is a draft

[atom]
id = "mine"
version = "0.1.0"
type = "nix:package" # or config, or chart, or ...

## DEPENENCIES ##

### BUILD TIME ###

#### srcs required for the build
#
[srcs.src] # available at `get.src`
url = "https://example.com/v${major}/${version}/pkg.src.tar.xz"
# capture the version here, for use in the url string
version = "${atom.version}"

#### git sources
#
[srcs.repo]
url = "https://github.com/owner/repo"
ref = "v1"

#### paths
#
[srcs.cargo]
path = "../Cargo.lock" # for use by builder libs

### EVAL TIME ###

#### atoms: the name of the key is the atom id to select from the url
#
[deps.atom] # available at `from.atom`
url = "https://github.com/ekala-project/atom"
version = "^1"

#### > eka add work:mono@^2
#
[deps.my-lib]
url = "https://github.com/org/mono"
version = "^2"

#### local atoms
#
[deps.local]
path = "../../path/to/other/atom"
version = "^3" # version used when resolved remotely

#### allow optional groups?
#
# [deps.lib.a-lib]
# ...
# a list of all the `deps.lib` could then be available at `from.libs`

#### pins have almost the same syntax as `srcs`
#
[pins.pkgs] # available at `from.pkgs`
url = "https://github.com/nixos/nixpkgs"
ref = "nixos-25.05"
# the expression to call `import` on
entry = "pkgs/top-level/impure.nix" 

#### reference values from the toml as arguments
#
[pins.pkgs.args]
localSystem = {system = "${platform.build}"}
crossSystem = {system = "${platform.host}"}

## BUILD CONFIG ##
# unique to the `package` type atom

#### basic platform
#
# platform = "x86_64-linux"

#### supported/tested/cached cross-comp matrix
#
[platform]
build = "x86_64-linux"
host = ["x86_64-linux", "aarch64-linux"]
# target = ...

#### alternate, condensed syntax? [ "builds,", "hosts,", "targets," ]
#
# platforms = [ "x86_64-linux", "{x86_,aarch}64-linux" ] # shell like expansion

#### abstract packages to support variants naturally
# > eka do --cc=clang --host=aarch64-linux <uri>
#
[provide]
ld = ["binutils", "mold"] # from `deps` (priority) or `pins`
cc = ["gcc", "clang"]
libc = ["glibc", "musl"]

# additional distrubition formats to output
# eka get --oci
dist = ["deb", "oci"]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions