Denis Defreyne

Making ddenv more modular

Up: ddenv

Core idea: Move all goal implementations into Lua plugins.

Example

The .config/ddenv.yaml file remains mostly unchanged, with the addition of information about where to find goal definitions:

up:
  - core/brew: ruby
  - brew: anyzig # same goal as above, but using default source (core)

sources:
  - name: "core"
    # TODO: how does this combine sources?
    url: "https://ddenv.denisdefreyne.com/goals/core/0.3.0.tar.gz"

default_source: "core"

indirect_sources:
  - "example.com/goals" # TODO: needs more thought

There ddenv command will download the relevant source files into a central location, like ~/.local/share/ddenv/goal-defs/cache/xxxxx, which will look like this:

local BrewPackageInstalled = ddenv.goal.create()

function BrewPackageInstalled:init(package_name)
    self.package_name = package_name
end

function BrewPackageInstalled:describe()
    return string.format("Installing Homebrew package `%s`", self.package_name)
end

function BrewPackageInstalled:is_achieved()
    -- ... do something with `self.package_name`
end

function BrewPackageInstalled:achieve()
    -- ... do something with `self.package_name`
end

ddenv.goal.provide(BrewPackageInstalled, "brew")

Or maybe more DSL-y:

-- this file: brew.lua

function init(package_name)
    self.package_name = package_name
end

function describe()
    return string.format("Installing Homebrew package `%s`", self.package_name)
end

function is_achieved()
    -- ... do something with `self.package_name`
end

function achieve()
    -- ... do something with `self.package_name`
end
ddenv.register("brew", "brew.lua")

There will also need to be a checksum store, maybe .config/ddenv.sum, e.g.

checksums:
  - url: "https://ddenv.denisdefreyne.com/goals/core/0.3.0.tar.gz"
    checksum: "sha256:f5e3c76f67e2f285bae3a54e27598cd4815e3a442d324aca3f0ba984a169f4fe"

This will need a ddenv fetch and ddenv verify command or so.

To do: how can vendors provide checksums? e.g. if I have a plugin that depends on 0.3.0 of a certain package, then I should also be able to provide the checksum for that package.

To do: figure out how to provide out-of-band metadata for packages. for example, I want to be able to yank a package.

To do: Figure out dependencies/prerequisites

Note last edited September 2026.