fleek

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: Apache-2.0 Imports: 16 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 Exists added in v0.9.4

func Exists(path string) bool

func FileContains added in v0.9.4

func FileContains(path string, substring string) (bool, error)

FileContains checks if a given file at 'path' contains the 'substring'

func Hostname

func Hostname() (string, error)

func IsDir added in v0.9.4

func IsDir(path string) bool

IsDir returns true if the path exists *and* it is pointing to a directory.

This function will traverse symbolic links to query information about the destination file.

This is a convenience function that coerces errors to false. If it cannot read the path for any reason (including a permission error, or a broken symbolic link) it returns false.

func IsFile added in v0.9.4

func IsFile(path string) bool

IsFile returns true if the path exists *and* it is pointing to a regular file.

This function will traverse symbolic links to query information about the destination file.

This is a convenience function that coerces errors to false. If it cannot read the path for any reason (including a permission error, or a broken symbolic link) it returns false.

func Levels

func Levels() []string

func MkdirAll

func MkdirAll(path string) error

func Move added in v0.9.4

func Move(oldPath, newPath string) error

func Name added in v0.9.0

func Name() (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)

func (*Bling) FinalPackages added in v0.9.4

func (b *Bling) FinalPackages(c *Config) []string

FinalPapckages returns the list of bling packages to install minus anything blocked in the config's Blocklist slice. Git is also removed if BYOGit is specified in the config

func (*Bling) FinalPrograms added in v0.9.4

func (b *Bling) FinalPrograms(c *Config) []string

FinalPrograms returns the list of bling programs to install minus anything blocked in the config's Blocklist slice. Git is also removed if BYOGit is specified in the config

type Config

type Config struct {
	MinVersion string `yaml:"min_version"`
	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"`
	Overlays map[string]*Overlay `yaml:",flow"`
	Packages []string            `yaml:",flow"`
	Programs []string            `yaml:",flow"`
	// issue 211, remove or block bling packages
	Blocklist []string          `yaml:"blocklist,flow"`
	Aliases   map[string]string `yaml:",flow"`
	Paths     []string          `yaml:"paths"`
	Ejected   bool              `yaml:"ejected"`
	// issue 200 - disable any git integration
	BYOGit  bool      `yaml:"byo_git"`
	Systems []*System `yaml:",flow"`
	Git     Git       `yaml:"git"`
	Users   []*User   `yaml:",flow"`
	Track   string    `yaml:"track"`
}

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

func ReadConfig

func ReadConfig(loc string) (*Config, error)

ReadConfig returns the configuration data pointed to in the $HOME/.fleek.yml symlink

func (*Config) AddPackage

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

func (*Config) AddProgram

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

func (*Config) AsVersion added in v0.9.0

func (c *Config) AsVersion() (*version.Version, 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) Migrate added in v0.9.4

func (c *Config) Migrate() error

func (*Config) NeedsMigration added in v0.9.4

func (c *Config) NeedsMigration() bool

Needs migration checks to see if the host directory has a file with the same name as the host. e.g. ./beast/beast.nix

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) Tracks added in v0.9.4

func (c *Config) Tracks() string

func (*Config) UserFlakeDir

func (c *Config) UserFlakeDir() string

func (*Config) UserForSystem added in v0.9.0

func (c *Config) UserForSystem(system string) *User

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 Overlay added in v0.9.4

type Overlay struct {
	URL    string `yaml:"url"`
	Follow bool   `yaml:"follow"`
}

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)

type User added in v0.9.0

type User struct {
	Username          string `yaml:"username"`
	Name              string `yaml:"name"`
	Email             string `yaml:"email"`
	SSHPublicKeyFile  string `yaml:"ssh_public_key_file"`
	SSHPrivateKeyFile string `yaml:"ssh_private_key_file"`
}

func NewUser added in v0.9.0

func NewUser() (*User, error)

func (User) HomeDir added in v0.9.4

func (u User) HomeDir(s System) string

Jump to

Keyboard shortcuts

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