devbox

package
v0.0.0-...-0d3f7f9 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 58 Imported by: 0

Documentation

Overview

Package devbox creates isolated development environments.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoRecognizableShellFound = errors.New("SHELL in undefined, and couldn't find any common shells in PATH")

Functions

func GlobalDataPath

func GlobalDataPath() (string, error)

func InitConfig

func InitConfig(dir string) (bool, error)

func PrintEnvrcContent

func PrintEnvrcContent(w io.Writer, envFlags devopt.EnvFlags) error

func UploadInstallableToCache

func UploadInstallableToCache(
	ctx context.Context,
	stderr io.Writer,
	cacheURI, installable string,
) error

Types

type Devbox

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

func Open

func Open(opts *devopt.Opts) (*Devbox, error)

func (*Devbox) Add

func (d *Devbox) Add(ctx context.Context, pkgsNames []string, opts devopt.AddOpts) error

Add adds the `pkgs` to the config (i.e. devbox.json) and nix profile for this devbox project

func (*Devbox) AllPackageNamesIncludingRemovedTriggerPackages

func (d *Devbox) AllPackageNamesIncludingRemovedTriggerPackages() []string

AllPackageNamesIncludingRemovedTriggerPackages returns the all package names, including those added by plugins and also those removed by builtins. This has a gross name to differentiate it from AllPackages. Some uses cases for this are the lockfile and devbox list command.

TODO: We may want to get rid of this function and have callers build their own list. e.g. Some callers need different representations of flakes (lockfile vs devbox list)

func (*Devbox) AllPackages

func (d *Devbox) AllPackages() []*devpkg.Package

AllPackages returns the packages that are defined in devbox.json and recursively added by plugins. NOTE: This will not return packages removed by their plugin with the __remove_trigger_package field.

func (*Devbox) Config

func (d *Devbox) Config() *devconfig.Config

func (*Devbox) ConfigHash

func (d *Devbox) ConfigHash() (string, error)

func (*Devbox) EnvExports

func (d *Devbox) EnvExports(ctx context.Context, opts devopt.EnvExportsOpts) (string, error)

EnvExports returns a string of the env-vars that would need to be applied to define a Devbox environment. The string is of the form `export KEY=VALUE` for each env-var that needs to be applied.

func (*Devbox) EnvVars

func (d *Devbox) EnvVars(ctx context.Context) ([]string, error)

func (*Devbox) Generate

func (d *Devbox) Generate(ctx context.Context) error

func (*Devbox) GenerateDevcontainer

func (d *Devbox) GenerateDevcontainer(ctx context.Context, generateOpts devopt.GenerateOpts) error

GenerateDevcontainer generates devcontainer.json and Dockerfile for vscode run-in-container and GitHub Codespaces

func (*Devbox) GenerateDockerfile

func (d *Devbox) GenerateDockerfile(ctx context.Context, generateOpts devopt.GenerateOpts) error

GenerateDockerfile generates a Dockerfile that replicates the devbox shell

func (*Devbox) GenerateEnvrcFile

func (d *Devbox) GenerateEnvrcFile(ctx context.Context, force bool, envFlags devopt.EnvFlags) error

GenerateEnvrcFile generates a .envrc file that makes direnv integration convenient

func (*Devbox) HasDeprecatedPackages

func (d *Devbox) HasDeprecatedPackages() bool

func (*Devbox) Info

func (d *Devbox) Info(ctx context.Context, pkg string, markdown bool) (string, error)

func (*Devbox) Install

func (d *Devbox) Install(ctx context.Context) error

Install ensures that all the packages in the config are installed but does not run init hooks. It is used to power devbox install cli command.

func (*Devbox) InstallRunXPackages

func (d *Devbox) InstallRunXPackages(ctx context.Context) error

func (*Devbox) InstallablePackages

func (d *Devbox) InstallablePackages() []*devpkg.Package

InstallablePackages returns the packages that are to be installed

func (*Devbox) IsDirenvActive

func (d *Devbox) IsDirenvActive() bool

func (*Devbox) IsEnvEnabled

func (d *Devbox) IsEnvEnabled() bool

IsEnvEnabled checks if the devbox environment is enabled. This allows us to differentiate between global and individual project shells.

func (*Devbox) ListScripts

func (d *Devbox) ListScripts() []string

func (*Devbox) ListServices

func (d *Devbox) ListServices(ctx context.Context, runInCurrentShell bool) error

func (*Devbox) Lockfile

func (d *Devbox) Lockfile() *lock.File

func (*Devbox) NixPkgsCommitHash

func (d *Devbox) NixPkgsCommitHash() string

func (*Devbox) PluginManager

func (d *Devbox) PluginManager() *plugin.Manager

func (*Devbox) ProjectDir

func (d *Devbox) ProjectDir() string

func (*Devbox) ProjectDirHash

func (d *Devbox) ProjectDirHash() string

func (*Devbox) Pull

func (d *Devbox) Pull(ctx context.Context, opts devopt.PullboxOpts) error

func (*Devbox) Push

func (d *Devbox) Push(ctx context.Context, opts devopt.PullboxOpts) error

func (*Devbox) Remove

func (d *Devbox) Remove(ctx context.Context, pkgs ...string) error

Remove removes the `pkgs` from the config (i.e. devbox.json) and nix profile for this devbox project

func (*Devbox) RestartServices

func (d *Devbox) RestartServices(
	ctx context.Context, runInCurrentShell bool, serviceNames ...string,
) error

func (*Devbox) RunScript

func (d *Devbox) RunScript(ctx context.Context, cmdName string, cmdArgs []string) error

func (*Devbox) RunXPaths

func (d *Devbox) RunXPaths(ctx context.Context) (string, error)

func (*Devbox) Secrets

func (d *Devbox) Secrets(ctx context.Context) (*envsec.Envsec, error)

func (*Devbox) Services

func (d *Devbox) Services() (services.Services, error)

func (*Devbox) Shell

func (d *Devbox) Shell(ctx context.Context) error

func (*Devbox) StartProcessManager

func (d *Devbox) StartProcessManager(
	ctx context.Context,
	runInCurrentShell bool,
	requestedServices []string,
	background bool,
	processComposeFileOrDir string,
) error

func (*Devbox) StartServices

func (d *Devbox) StartServices(
	ctx context.Context, runInCurrentShell bool, serviceNames ...string,
) error

func (*Devbox) StopServices

func (d *Devbox) StopServices(ctx context.Context, runInCurrentShell, allProjects bool, serviceNames ...string) error

func (*Devbox) TopLevelPackages

func (d *Devbox) TopLevelPackages() []*devpkg.Package

func (*Devbox) UninitializedSecrets

func (d *Devbox) UninitializedSecrets(ctx context.Context) *envsec.Envsec

func (*Devbox) Update

func (d *Devbox) Update(ctx context.Context, opts devopt.UpdateOpts) error

func (*Devbox) UploadProjectToCache

func (d *Devbox) UploadProjectToCache(
	ctx context.Context,
	cacheURI string,
) error

type DevboxShell

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

DevboxShell configures a user's shell to run in Devbox. Its zero value is a fallback shell that launches a regular Nix shell.

func NewDevboxShell

func NewDevboxShell(devbox *Devbox, opts ...ShellOption) (*DevboxShell, error)

NewDevboxShell initializes the DevboxShell struct so it can be used to start a shell environment for the devbox project.

func (*DevboxShell) Run

func (s *DevboxShell) Run() error

type ShellOption

type ShellOption func(*DevboxShell)

func WithEnvVariables

func WithEnvVariables(envVariables map[string]string) ShellOption

TODO: Consider removing this once plugins add env vars directly to binaries via wrapper scripts.

func WithHistoryFile

func WithHistoryFile(historyFile string) ShellOption

func WithProjectDir

func WithProjectDir(projectDir string) ShellOption

func WithShellStartTime

func WithShellStartTime(t time.Time) ShellOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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