core

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LowPackages     = []string{"htop", "git", "github-cli", "glab"}
	DefaultPackages = []string{"fzf", "ripgrep", "vscode"}
	HighPackages    = []string{"lazygit", "jq", "yq", "neovim", "neofetch", "btop", "cheat"}
	LowPrograms     = []string{"starship"}
	DefaultPrograms = []string{"direnv"}
	HighPrograms    = []string{"exa", "bat", "atuin", "zoxide"}
)
View Source
var (
	ErrMissingFlakeDir        = errors.New("fleek.yml: missing `flakedir`")
	ErrInvalidShell           = errors.New("fleek.yml: invalid shell, valid shells are: " + strings.Join(shells, ", "))
	ErrInvalidBling           = errors.New("fleek.yml: invalid bling level, valid levels are: " + strings.Join(blingLevels, ", "))
	ErrorInvalidArch          = errors.New("fleek.yml: invalid architecture, valid architectures are: " + strings.Join(architectures, ", "))
	ErrInvalidOperatingSystem = errors.New("fleek.yml: invalid OS, valid operating systems are: " + strings.Join(operatingSystems, ", "))
	ErrPackageNotFound        = errors.New("package not found in configuration file")
	ErrProgramNotFound        = errors.New("program not found in configuration file")
)
View Source
var ErrSysNotFound = errors.New("system not found")

Functions

func Arch

func Arch() string

func Hostname

func Hostname() (string, error)

func MkdirAll

func MkdirAll(path string) error

func Runtime

func Runtime() string

func UserShell

func UserShell() (string, error)

func Username

func Username() (string, error)

func WriteSampleConfig

func WriteSampleConfig(location, email, name string, force bool) error

WriteSampleConfig creates the first fleek configuration file

Types

type Alias

type Alias struct {
	Key         string `yaml:"key"`
	Value       string `yaml:"value"`
	Description string `yaml:"description"`
}

type Bling

type Bling struct {
	Name        string   `yaml:"name"`
	Description string   `yaml:"description"`
	Packages    []string `yaml:"packages"`
	Programs    []string `yaml:"programs"`
	PackageMap  map[string]*Package
	ProgramMap  map[string]*Program
}

func DefaultBling

func DefaultBling() (*Bling, error)

func HighBling

func HighBling() (*Bling, error)

func LowBling

func LowBling() (*Bling, error)

func NoBling

func NoBling() (*Bling, error)

type Config

type Config struct {
	FlakeDir string `yaml:"flakedir"`
	Unfree   bool   `yaml:"unfree"`
	// bash or zsh
	Shell string `yaml:"shell"`
	// low, default, high
	Bling      string            `yaml:"bling"`
	Repository string            `yaml:"repo"`
	Name       string            `yaml:"name"`
	Packages   []string          `yaml:",flow"`
	Programs   []string          `yaml:",flow"`
	Aliases    map[string]string `yaml:",flow"`
	Paths      []string          `yaml:"paths"`
	Ejected    bool              `yaml:"ejected"`
	Systems    []System          `yaml:",flow"`
}

Config holds the options that will be merged into the home-manager flake.

func ReadConfig

func ReadConfig() (*Config, error)

ReadConfig returns the configuration data stored in $HOME/.fleek.yml

func (*Config) AddPackage

func (c *Config) AddPackage(pack string) error

func (*Config) AddProgram

func (c *Config) AddProgram(prog string) error

func (*Config) Clone

func (c *Config) Clone(repo string) error

func (*Config) Eject

func (c *Config) Eject() error

WriteEjectConfig updates the .fleek.yml file to indicated ejected status

func (*Config) Location

func (c *Config) Location() (string, error)

ConfigLocation returns the path for the fleek configuration file.

func (*Config) MakeFlakeDir

func (c *Config) MakeFlakeDir() error

MakeFlakeDir creates the directory that holds the interpolated flake.

func (*Config) RemovePackage

func (c *Config) RemovePackage(pack string) error

func (*Config) RemoveProgram

func (c *Config) RemoveProgram(prog string) error

func (*Config) Save

func (c *Config) Save() error

func (*Config) UserFlakeDir

func (c *Config) UserFlakeDir() string

func (*Config) Validate

func (c *Config) Validate() error

type ConfigLine

type ConfigLine struct {
	Key   string `yaml:"key"`
	Value string `yaml:"value"`
}

ConfigLine represents a line of a program's configuration. It must be in the form of `key = value“ such that multiple config lines for the same program can be appended together to create a valid configuration.

type GitConfig

type GitConfig struct {
	Name  string `yaml:"name"`
	Email string `yaml:"email"`
}

type Package

type Package struct {
	Name        string `yaml:"name"`
	Description string `yaml:"description"`
}

Package is an binary or library that can be installed

func LoadPackages

func LoadPackages() ([]*Package, error)

type Program

type Program struct {
	Name        string `yaml:"name"`
	Description string `yaml:"description"`

	ConfigLines []ConfigLine `yaml:"config_lines,flow"`
	Aliases     []Alias      `yaml:",flow"`
}

Program is an application that is installed and also has configuration attached.

func LoadPrograms

func LoadPrograms() ([]*Program, error)

type System

type System struct {
	Hostname  string    `yaml:"hostname"`
	Username  string    `yaml:"username"`
	Arch      string    `yaml:"arch"`
	OS        string    `yaml:"os"`
	GitConfig GitConfig `yaml:"git"`
}

func CurrentSystem

func CurrentSystem() (*System, error)

func NewSystem

func NewSystem(name, email string) (*System, error)

func (System) HomeDir

func (s System) HomeDir() string

Jump to

Keyboard shortcuts

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