Documentation ¶
Index ¶
- Constants
- func Init(dir string, writer io.Writer) (created bool, err error)
- func ValidateNixpkg(cfg *Config) error
- func WriteConfig(path string, cfg *Config) error
- type Config
- func (c *Config) ComputedEnv(ctx context.Context, projectDir string) (map[string]string, error)
- func (c *Config) Equals(other *Config) bool
- func (c *Config) Hash() (string, error)
- func (c *Config) InitHook() *shellcmd.Commands
- func (c *Config) IsEnvsecEnabled() bool
- func (c *Config) NixPkgsCommitHash() string
- func (c *Config) SaveTo(path string) error
- func (c *Config) Scripts() map[string]*shellcmd.Commands
- type NixpkgsConfig
- type Package
- type Packages
- func (pkgs *Packages) Add(versionedName string)
- func (pkgs *Packages) AddPlatforms(writer io.Writer, versionedname string, platforms []string) error
- func (pkgs *Packages) ExcludePlatforms(writer io.Writer, versionedName string, platforms []string) error
- func (pkgs *Packages) Get(versionedName string) (*Package, bool)
- func (pkgs *Packages) MarshalJSON() ([]byte, error)
- func (pkgs *Packages) Remove(versionedName string)
- func (pkgs *Packages) UnmarshalJSON(data []byte) error
- func (pkgs *Packages) VersionedNames() []string
- type Stage
Constants ¶
const DefaultName = "devbox.json"
Variables ¶
This section is empty.
Functions ¶
func ValidateNixpkg ¶
func WriteConfig ¶
WriteConfig saves a devbox config file.
Types ¶
type Config ¶
type Config struct { // Packages is the slice of Nix packages that devbox makes available in // its environment. Deliberately do not omitempty. Packages Packages `json:"packages"` // Env allows specifying env variables Env map[string]string `json:"env,omitempty"` // Only allows "envsec" for now EnvFrom string `json:"env_from,omitempty"` // Shell configures the synopkg.github.io/devboxell environment. Shell *shellConfig `json:"shell,omitempty"` // Nixpkgs specifies the repository to pull packages from // Deprecated: Versioned packages don't need this Nixpkgs *NixpkgsConfig `json:"nixpkgs,omitempty"` // Reserved to allow including other config files. Proposed format is: // path: for local files // https:// for remote files // plugin: for built-in plugins // This is a similar format to nix inputs Include []string `json:"include,omitempty"` }
Config defines a devbox environment as JSON.
func DefaultConfig ¶
func DefaultConfig() *Config
func LoadConfigFromURL ¶
func (*Config) ComputedEnv ¶
func (*Config) IsEnvsecEnabled ¶
func (*Config) NixPkgsCommitHash ¶
type NixpkgsConfig ¶
type NixpkgsConfig struct {
Commit string `json:"commit,omitempty"`
}
type Package ¶
type Package struct { Version string `json:"version,omitempty"` Platforms []string `json:"platforms,omitempty"` ExcludedPlatforms []string `json:"excluded_platforms,omitempty"` // contains filtered or unexported fields }
func NewVersionOnlyPackage ¶
func (*Package) IsEnabledOnPlatform ¶
enabledOnPlatform returns whether the package is enabled on the given platform. If the package has a list of platforms, it is enabled only on those platforms. If the package has a list of excluded platforms, it is enabled on all platforms except those.
func (Package) MarshalJSON ¶
func (*Package) UnmarshalJSON ¶
func (*Package) VersionedName ¶
type Packages ¶
type Packages struct { // Collection contains the set of package definitions // We don't want this key to be serialized automatically, hence the "key" in json is "-" // NOTE: this is not a pointer to make debugging failure cases easier // (get dumps of the values, not memory addresses) Collection []Package `json:"-,omitempty"` // contains filtered or unexported fields }
func (*Packages) AddPlatforms ¶
func (pkgs *Packages) AddPlatforms(writer io.Writer, versionedname string, platforms []string) error
AddPlatforms adds a platform to the list of platforms for a given package
func (*Packages) ExcludePlatforms ¶
func (pkgs *Packages) ExcludePlatforms(writer io.Writer, versionedName string, platforms []string) error
ExcludePlatforms adds a platform to the list of excluded platforms for a given package
func (*Packages) MarshalJSON ¶
func (*Packages) UnmarshalJSON ¶
func (*Packages) VersionedNames ¶
VersionedNames returns a list of package names with versions. NOTE: if the package is unversioned, the version will be omitted (doesn't default to @latest).
example: ["package1", "package2@latest", "package3@1.20"]