facts

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package facts holds the system facts used for module selection.

Index

Constants

This section is empty.

Variables

View Source
var KernelRelease = func() (string, error) {
	out, err := exec.Command("uname", "-r").Output()
	if err != nil {
		return "", fmt.Errorf("query kernel release: %w", err)
	}
	return strings.TrimSpace(string(out)), nil
}

KernelRelease returns the running kernel release (`uname -r`). It is a package-level var so tests can stub the lookup.

Functions

func CheckKernelConstraint added in v0.9.0

func CheckKernelConstraint(expr string) error

CheckKernelConstraint validates one "<op> <version>" kernel constraint expression (the when.kernel grammar), with <op> one of < <= > >= == !=. Empty or malformed expressions are rejected loudly; callers treating an empty expression as "unset" must check for it first.

func CompareKernel added in v0.9.0

func CompareKernel(release, op, version string) (bool, error)

CompareKernel compares a running kernel release against one constraint ("<", "<=", ">", ">=", "==", "!=" and a dotted-numeric version). Version comparison is numeric per dotted segment (7.10 > 7.1), with missing segments treated as zero; a distro suffix on the release ("6.12.1-arch1-1") is ignored.

Types

type Facts

type Facts struct {
	Hostname string
	Username string
	OS       string
	// Kernel is the running kernel release (`uname -r`, e.g.
	// "6.12.1-arch1-1"); empty when detection failed.
	Kernel string
	// InstalledPackages records which packages a when.packages filter
	// referenced as installed on the running system, probed lazily at
	// profile load via the detected package backend. nil (nothing probed
	// or nothing installed) means a non-empty when.packages constraint
	// never matches — the same contract as an empty Kernel fact.
	InstalledPackages map[string]bool
	// InstalledTools records which mise-managed tools a when.tools filter
	// referenced as installed on the running system, probed lazily at
	// profile load via `mise current` (presence only, version ignored).
	// nil (nothing probed, mise missing, or nothing installed) means a
	// non-empty when.tools constraint never matches.
	InstalledTools map[string]bool
	Distro         string
	GPU            string
	Backend        string
}

Facts holds the system facts used for module selection.

Jump to

Keyboard shortcuts

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