toolenv

package
v0.0.73 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package toolenv prepares retained, version-isolated CLI installations. It never installs tools from the timed operation path or changes the process environment.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NixSystem

func NixSystem() (string, error)

Types

type Diagnostics

type Diagnostics struct {
	TaskOrdinal *int64           `json:"task_ordinal,omitempty"`
	WallMS      int64            `json:"wall_ms"`
	Tools       []ToolDiagnostic `json:"tools,omitempty"`
	Error       string           `json:"error,omitempty"`
}

type Environment

type Environment struct {
	Path  string `json:"path"`
	Tools []Tool `json:"tools"`
}

func (Environment) Ready

func (e Environment) Ready() bool

Ready is strictly local and read-only. False means return to setup, never install or resolve a package inside the task's execution budget.

type Manager

type Manager struct{ Root string }

Manager owns only a local cache. Providers can retain/mount Root at the same absolute path. Package managers and their runtimes must exist in the base.

func Default

func Default() (*Manager, error)

func (*Manager) Prepare

func (m *Manager) Prepare(ctx context.Context, scopes []Scope) (env Environment, diag Diagnostics, err error)

Prepare resolves each declaration on first use, sharing completed entries across scopes/invocations. No manager runs on a warm hit.

func (*Manager) PrepareNixPackage

func (m *Manager) PrepareNixPackage(ctx context.Context, p NixPackage) (root string, reused bool, err error)

PrepareNixPackage realizes only the pinned output, with a retained GC root. It never re-evaluates the original selector or builds missing outputs.

type NixPackage

type NixPackage struct {
	StorePath string          `json:"store_path"`
	System    string          `json:"system"`
	Manifest  json.RawMessage `json:"manifest"`
}

NixPackage is evaluation metadata, not an installed package. StorePath pins realization to exactly the output described by Manifest, even if a ref moves.

func DescribeNixPackage

func DescribeNixPackage(ctx context.Context, reference, baseDir string) (*NixPackage, error)

DescribeNixPackage evaluates passthru.c2j and the output identity together. Import-from-derivation is forbidden: metadata inspection cannot realize code.

func (NixPackage) Validate

func (p NixPackage) Validate() error

type Scope

type Scope struct {
	ID       string   `json:"id"`
	Packages []string `json:"packages"`
}

type Tool

type Tool struct {
	Reference   string   `json:"reference"`
	Bin         string   `json:"bin"`
	Executables []string `json:"executables"`
	Main        string   `json:"main,omitempty"`
	Identity    string   `json:"identity"`
}

type ToolDiagnostic

type ToolDiagnostic struct {
	Reference string `json:"reference"`
	Identity  string `json:"identity,omitempty"`
	Scope     string `json:"scope"`
	WallMS    int64  `json:"wall_ms"`
	Outcome   string `json:"outcome"`
}

Jump to

Keyboard shortcuts

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