fleek

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 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 CheckNix

func CheckNix() bool

CheckNix verifies that the nix command is available in user's PATH

func Hostname

func Hostname() (string, error)

func Levels

func Levels() []string

func MkdirAll

func MkdirAll(path string) error

func Runtime

func Runtime() string

func SSHAuthSock

func SSHAuthSock() bool

func UserShell

func UserShell() (string, error)

func Username

func Username() (string, error)

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 {
	Debug    bool   `yaml:"-"`
	Verbose  bool   `yaml:"-"`
	Force    bool   `yaml:"-"`
	Quiet    bool   `yaml:"-"`
	FlakeDir string `yaml:"flakedir"`
	Unfree   bool   `yaml:"unfree"`
	// bash or zsh
	Shell string `yaml:"shell"`
	// low, default, high
	Bling    string            `yaml:"bling"`
	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"`
	Git      Git               `yaml:"git"`
}

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) CurrentSystem

func (c *Config) CurrentSystem() (*System, error)

func (*Config) Eject

func (c *Config) Eject() error

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

func (*Config) GitLocation

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

GitLocation returns the path for the fleek configuration git directory

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

func (*Config) WriteInitialConfig

func (c *Config) WriteInitialConfig(force bool, symlink bool) 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 Git

type Git struct {
	Enabled    bool `yaml:"enabled"`
	AutoCommit bool `yaml:"autocommit"`
	AutoPush   bool `yaml:"autopush"`
	AutoPull   bool `yaml:"autopull"`
}

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"`
}

func NewSystem

func NewSystem() (*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