profile

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package profile loads and selects modules from a profile.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ModuleDir

func ModuleDir(root, layer, id string) string

ModuleDir returns the path to a module directory under the given profile root.

Types

type Config

type Config struct {
	Modules ModulesConfig `toml:"modules"`
}

Config is the top-level dotdrift.toml configuration.

type Dotfile

type Dotfile struct {
	Source string `toml:"source"`
	Mode   string `toml:"mode"`
}

Dotfile describes a single managed path.

type Module

type Module struct {
	ID     string
	App    string
	Path   string
	Config ModuleConfig
}

Module is a discovered module with its resolved identity and path.

type ModuleConfig

type ModuleConfig struct {
	ID       string             `toml:"id"`
	App      string             `toml:"app"`
	When     When               `toml:"when"`
	Packages Packages           `toml:"packages"`
	Tools    map[string]string  `toml:"tools"`
	Dotfiles map[string]Dotfile `toml:"dotfiles"`
}

ModuleConfig is the base module.toml configuration.

func LoadModuleConfig

func LoadModuleConfig(dir string) (*ModuleConfig, error)

LoadModuleConfig reads a module.toml from the given directory. It returns the parsed config and the resolved module path, or nil if no module.toml exists.

type ModulesConfig

type ModulesConfig struct {
	Disable []string `toml:"disable"`
}

ModulesConfig holds the [modules] table.

type Packages

type Packages struct {
	Present []string `toml:"present"`
	Absent  []string `toml:"absent"`
}

Packages declares packages a module needs or forbids.

type Profile

type Profile struct {
	Root     string
	Config   Config
	Modules  []Module
	Selected []Module
	Skipped  []Skip
}

Profile is the loaded set of modules and selection state.

func Load

func Load(root string, f *facts.Facts) (*Profile, error)

Load reads a profile directory, unions dotdrift.toml layers, discovers modules, and runs selection against the provided facts.

func (*Profile) Select

func (p *Profile) Select(f *facts.Facts)

Select re-evaluates which modules are selected or skipped.

type Skip

type Skip struct {
	Module Module
	Reason string
}

Skip records a module that was not selected and why.

type When

type When struct {
	Hosts []string `toml:"hosts"`
	Users []string `toml:"users"`
	OS    []string `toml:"os"`
	GPU   string   `toml:"gpu"`
}

When filters a module by host, user, os, or gpu. Empty fields are ignored; non-empty fields must all match.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL