configfile

package
v0.0.0-...-b4a2add Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultName = "devbox.json"
)

Variables

This section is empty.

Functions

func ValidateNixpkg

func ValidateNixpkg(cfg *ConfigFile) error

Types

type ConfigFile

type ConfigFile struct {
	// AbsRootPath is the absolute path to the devbox.json or plugin.json file
	// it will not be set for github plugins.
	AbsRootPath string `json:"-"`

	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`

	// PackagesMutator is the slice of Nix packages that devbox makes available in
	// its environment. Deliberately do not omitempty.
	PackagesMutator PackagesMutator `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 devbox shell 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"`
	// contains filtered or unexported fields
}

ConfigFile defines a devbox environment as JSON.

func LoadBytes

func LoadBytes(b []byte) (*ConfigFile, error)

func (*ConfigFile) Bytes

func (c *ConfigFile) Bytes() []byte

func (*ConfigFile) Equals

func (c *ConfigFile) Equals(other *ConfigFile) bool

func (*ConfigFile) GetPackage

func (c *ConfigFile) GetPackage(versionedName string) (*Package, bool)

Get returns the package with the given versionedName

func (*ConfigFile) Hash

func (c *ConfigFile) Hash() (string, error)

func (*ConfigFile) InitHook

func (c *ConfigFile) InitHook() *shellcmd.Commands

func (*ConfigFile) IsEnvsecEnabled

func (c *ConfigFile) IsEnvsecEnabled() bool

func (*ConfigFile) NixPkgsCommitHash

func (c *ConfigFile) NixPkgsCommitHash() string

func (*ConfigFile) SaveTo

func (c *ConfigFile) SaveTo(path string) error

SaveTo writes the config to a file.

func (*ConfigFile) Scripts

func (c *ConfigFile) Scripts() Scripts

func (*ConfigFile) SetStringField

func (c *ConfigFile) SetStringField(fieldName, val string)

func (*ConfigFile) TopLevelPackages

func (c *ConfigFile) TopLevelPackages() []Package

TopLevelPackages returns the packages in the config file, but not the included ones. Semi-awkwardly named to avoid confusion with the Packages method on Config.

type NixpkgsConfig

type NixpkgsConfig struct {
	Commit string `json:"commit,omitempty"`
}

type Package

type Package struct {
	Name    string
	Version string `json:"version,omitempty"`

	DisablePlugin     bool     `json:"disable_plugin,omitempty"`
	Platforms         []string `json:"platforms,omitempty"`
	ExcludedPlatforms []string `json:"excluded_platforms,omitempty"`

	// PatchGlibc applies a function to the package's derivation that
	// patches any ELF binaries to use the latest version of nixpkgs#glibc.
	PatchGlibc bool `json:"patch_glibc,omitempty"`

	// Outputs is the list of outputs to use for this package, assuming
	// it is a nix package. If empty, the default output is used.
	Outputs []string `json:"outputs,omitempty"`

	// AllowInsecure is a whitelist of packages that may be marked insecure
	// in nixpkgs, but are allowed by the user to be installed.
	AllowInsecure []string `json:"allow_insecure,omitempty"`
}

func NewVersionOnlyPackage

func NewVersionOnlyPackage(name, version string) Package

func (*Package) IsEnabledOnPlatform

func (p *Package) IsEnabledOnPlatform() bool

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

func (p *Package) UnmarshalJSON(data []byte) error

func (*Package) VersionedName

func (p *Package) VersionedName() string

type PackagesMutator

type PackagesMutator struct {
	// contains filtered or unexported fields
}

func (*PackagesMutator) Add

func (pkgs *PackagesMutator) Add(versionedName string)

Add adds a package to the list of packages

func (*PackagesMutator) AddPlatforms

func (pkgs *PackagesMutator) AddPlatforms(writer io.Writer, versionedname string, platforms []string) error

AddPlatforms adds a platform to the list of platforms for a given package

func (*PackagesMutator) ExcludePlatforms

func (pkgs *PackagesMutator) ExcludePlatforms(writer io.Writer, versionedName string, platforms []string) error

ExcludePlatforms adds a platform to the list of excluded platforms for a given package

func (*PackagesMutator) Remove

func (pkgs *PackagesMutator) Remove(versionedName string)

Remove removes a package from the list of packages

func (*PackagesMutator) SetAllowInsecure

func (pkgs *PackagesMutator) SetAllowInsecure(writer io.Writer, versionedName string, whitelist []string) error

func (*PackagesMutator) SetDisablePlugin

func (pkgs *PackagesMutator) SetDisablePlugin(versionedName string, v bool) error

func (*PackagesMutator) SetOutputs

func (pkgs *PackagesMutator) SetOutputs(writer io.Writer, versionedName string, outputs []string) error

func (*PackagesMutator) SetPatchGLibc

func (pkgs *PackagesMutator) SetPatchGLibc(versionedName string, v bool) error

func (*PackagesMutator) UnmarshalJSON

func (pkgs *PackagesMutator) UnmarshalJSON(data []byte) error

type Scripts

type Scripts map[string]*script

func (Scripts) WithRelativePaths

func (s Scripts) WithRelativePaths(projectDir string) Scripts

type Stage

type Stage struct {
	Command string `json:"command"`
}

Stage contains a subset of fields from plansdk.Stage

Jump to

Keyboard shortcuts

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