Documentation
¶
Overview ¶
Package fest provides a declarative system configuration management framework for Arch Linux.
It allows you to declare your system state (packages, services, files) and synchronizes the actual system state to match. The package supports various resource types including pacman packages, flatpak apps, npm packages, Go packages, Ruby gems, systemd services, user groups, system files, and dotfile management via GNU Stow.
Index ¶
- func After(resourceName ResourceName, callback Callback)
- func Before(resourceName ResourceName, callback Callback)
- func Flatpak(apps ...string)
- func GoPackage(pkgs ...string)
- func Group(grps ...string)
- func Keyboard(keymap, layout, model, variant, options string)
- func Locale(locale string)
- func Main()
- func NpmPackage(pkgs ...string)
- func OnCommand(phase CommandPhase, callback Callback)
- func Package(pkgs ...string)
- func PackageGroup(groupNames ...string)
- func RubyGem(gems ...string)
- func Service(svcs ...string)
- func Socket(socks ...string)
- func SystemFilesDir(dir string)
- func SystemService(svcs ...string)
- func SystemSocket(socks ...string)
- func SystemTimer(tmrs ...string)
- func Timedate(timezone string, ntp bool)
- func Timer(tmrs ...string)
- type Callback
- type CommandPhase
- type ResourceName
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func After ¶
func After(resourceName ResourceName, callback Callback)
After registers a callback to be executed after the given resource name is synced.
func Before ¶
func Before(resourceName ResourceName, callback Callback)
Before registers a callback to be executed before the given resource name is synced.
func Flatpak ¶
func Flatpak(apps ...string)
Flatpak declares desired flatpak applications (by application ID). Applications are installed from Flathub by default.
Example:
managers.Flatpak(
"com.slack.Slack",
"com.github.tchx84.Flatseal",
"org.mozilla.firefox",
)
func GoPackage ¶
func GoPackage(pkgs ...string)
GoPackage declares Go packages to install using `go install`. Packages are installed to GOBIN or $GOPATH/bin. Supports version pinning using @version syntax.
Example:
fest.GoPackage(
"github.com/golangci/golangci-lint/cmd/golangci-lint@latest",
"golang.org/x/tools/cmd/goimports@v0.15.0",
)
func Group ¶
func Group(grps ...string)
Group declares user groups that the current user should be a member of. The user is added to these groups using usermod -aG.
Example:
fest.Group("docker", "wheel", "audio", "video")
func Keyboard ¶
func Keyboard(keymap, layout, model, variant, options string)
Keyboard sets keyboard configuration for both console and X11. Parameters:
- keymap: Console keymap (e.g., "us")
- layout: X11 keyboard layout (e.g., "us,ara" for multiple layouts)
- model: Keyboard model (e.g., "pc105")
- variant: Layout variant (e.g., "dvorak")
- options: Keyboard options (e.g., "ctrl:nocaps,grp:alt_shift_toggle")
Example:
fest.Keyboard("us", "us", "pc105", "", "ctrl:nocaps")
func Locale ¶
func Locale(locale string)
Locale sets the system locale. The locale string should match an entry in /etc/locale.gen.
Example:
fest.Locale("en_US.UTF-8 UTF-8")
func Main ¶
func Main()
Main is the entry point for the archlinux configuration management system. It handles command-line argument parsing and dispatches to the appropriate command handler.
Available commands:
- apply: Synchronize system state with declared configuration
- save: Save current system state as declarative Go code
- diff: Show what would change without making actual changes
This function should be called from your main package after declaring your desired configuration.
func NpmPackage ¶
func NpmPackage(pkgs ...string)
NpmPackage declares global npm packages to install. Supports version pinning using @version syntax. Handles scoped packages correctly (e.g., @vue/cli).
Example:
fest.NpmPackage(
"typescript",
"@vue/cli",
"eslint@8.50.0", // Pin to specific version
)
func OnCommand ¶
func OnCommand(phase CommandPhase, callback Callback)
OnCommand registers a callback to be executed during the given command phase.
func Package ¶
func Package(pkgs ...string)
Package declares one or more pacman packages to be installed. Packages can be from official repositories or AUR.
Example:
fest.Package("vim", "git", "docker")
func PackageGroup ¶
func PackageGroup(groupNames ...string)
PackageGroup expands pacman package groups into individual packages. This queries pacman for all packages in the given groups and adds them.
Example:
fest.PackageGroup("base-devel")
func RubyGem ¶
func RubyGem(gems ...string)
RubyGem declares Ruby gems to install for the current user. Supports version pinning and version constraints:
- gem@1.0.0: Exact version
- gem@~>1.0: Pessimistic version constraint (>= 1.0, < 2.0)
- gem@>=1.0.0: Minimum version
Example:
fest.RubyGem(
"bundler",
"rails@7.0.0",
"puma@~>5.0",
)
func Service ¶
func Service(svcs ...string)
Service declares user-level systemd services to enable. Services run as the current user.
Example:
fest.Service("syncthing", "ssh-agent")
func Socket ¶
func Socket(socks ...string)
Socket declares user-level systemd sockets to enable.
Example:
fest.Socket("pipewire")
func SystemFilesDir ¶
func SystemFilesDir(dir string)
SystemFilesDir adds a directory to scan for system files to deploy. Files in this directory are copied to the system, mirroring the directory structure. For example, a file at "system/etc/hosts" will be copied to "/etc/hosts".
The framework tracks changes and can restore original files when uninstalling.
Example:
fest.SystemFilesDir("system") // Default
fest.SystemFilesDir("custom-system-files") // Additional directory
func SystemService ¶
func SystemService(svcs ...string)
SystemService declares system-level systemd services to enable. Services are enabled and started on apply.
Example:
fest.SystemService("docker", "sshd")
func SystemSocket ¶
func SystemSocket(socks ...string)
SystemSocket declares system-level systemd sockets to enable.
Example:
fest.SystemSocket("docker")
func SystemTimer ¶
func SystemTimer(tmrs ...string)
SystemTimer declares system-level systemd timers to enable.
Example:
fest.SystemTimer("fstrim")
Types ¶
type Callback ¶
type Callback func()
Callback is a function that can be executed before or after a package manager operation.
type CommandPhase ¶
type CommandPhase string
CommandPhase represents a phase in the command lifecycle.
const ( PhaseBeforeDiff CommandPhase = "before-diff" PhaseAfterDiff CommandPhase = "after-diff" PhaseBeforeSave CommandPhase = "before-save" PhaseAfterSave CommandPhase = "after-save" PhaseBeforeApply CommandPhase = "before-apply" PhaseAfterApply CommandPhase = "after-apply" )
Available command lifecycle phases.
type ResourceName ¶
type ResourceName string
ResourceName represents a package manager resource type identifier.
const ( ResourceSystemServices ResourceName = "system services" ResourceSystemTimers ResourceName = "system timers" ResourceSystemSockets ResourceName = "system sockets" ResourceUserServices ResourceName = "user services" ResourceUserTimers ResourceName = "user timers" ResourceUserSockets ResourceName = "user sockets" )
const ResourceBrokenSymlinks ResourceName = "broken symlinks"
const ResourceFlatpak ResourceName = "flatpak"
const ResourceGoPackages ResourceName = "Go packages"
const ResourceNpmPackages ResourceName = "npm packages"
const ResourcePackages ResourceName = "packages"
ResourcePackages is the resource name for pacman packages.
const ResourceRubyGems ResourceName = "Ruby gems"
const ResourceUserGroups ResourceName = "user groups"
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Experimental code for install local with dependency refactoring Not at feature parity with install.go
|
Experimental code for install local with dependency refactoring Not at feature parity with install.go |
|
pkg/cmd/graph
command
|
|
|
pkg/menus
Clean Build Menu functions
|
Clean Build Menu functions |