Documentation ¶
Overview ¶
Package devbox creates isolated development environments.
Index ¶
- Constants
- Variables
- func EnsureConfig(dir string) error
- func GlobalDataPath() (string, error)
- func InitConfig(dir string) error
- func PrintEnvrcContent(w io.Writer, envFlags devopt.EnvFlags) error
- func UploadInstallableToCache(ctx context.Context, stderr io.Writer, cacheURI, installable string) error
- type Devbox
- func (d *Devbox) Add(ctx context.Context, pkgsNames []string, opts devopt.AddOpts) error
- func (d *Devbox) AllPackageNamesIncludingRemovedTriggerPackages() []string
- func (d *Devbox) AllPackages() []*devpkg.Package
- func (d *Devbox) AllPackagesIncludingRemovedTriggerPackages() []*devpkg.Package
- func (d *Devbox) AttachToProcessManager(ctx context.Context) error
- func (d *Devbox) Config() *devconfig.Config
- func (d *Devbox) ConfigHash() (string, error)
- func (d *Devbox) EnvExports(ctx context.Context, opts devopt.EnvExportsOpts) (string, error)
- func (d *Devbox) EnvVars(ctx context.Context) ([]string, error)
- func (d *Devbox) FixMissingStorePaths(ctx context.Context) error
- func (d *Devbox) Generate(ctx context.Context) error
- func (d *Devbox) GenerateDevcontainer(ctx context.Context, generateOpts devopt.GenerateOpts) error
- func (d *Devbox) GenerateDockerfile(ctx context.Context, generateOpts devopt.GenerateOpts) error
- func (d *Devbox) GenerateEnvrcFile(ctx context.Context, force bool, envFlags devopt.EnvFlags) error
- func (d *Devbox) HasDeprecatedPackages() bool
- func (d *Devbox) Info(ctx context.Context, pkg string, markdown bool) (string, error)
- func (d *Devbox) Install(ctx context.Context) error
- func (d *Devbox) InstallRunXPackages(ctx context.Context) error
- func (d *Devbox) InstallablePackages() []*devpkg.Package
- func (d *Devbox) IsDirenvActive() bool
- func (d *Devbox) IsEnvEnabled() bool
- func (d *Devbox) ListScripts() []string
- func (d *Devbox) ListServices(ctx context.Context, runInCurrentShell bool) error
- func (d *Devbox) Lockfile() *lock.File
- func (d *Devbox) PluginManager() *plugin.Manager
- func (d *Devbox) ProjectDir() string
- func (d *Devbox) ProjectDirHash() string
- func (d *Devbox) Pull(ctx context.Context, opts devopt.PullboxOpts) error
- func (d *Devbox) Push(ctx context.Context, opts devopt.PullboxOpts) error
- func (d *Devbox) RefreshAliasOrCommand() string
- func (d *Devbox) Remove(ctx context.Context, pkgs ...string) error
- func (d *Devbox) RestartServices(ctx context.Context, runInCurrentShell bool, serviceNames ...string) error
- func (d *Devbox) RunScript(ctx context.Context, envOpts devopt.EnvOptions, cmdName string, ...) error
- func (d *Devbox) RunXPaths(ctx context.Context) (string, error)
- func (d *Devbox) Secrets(ctx context.Context) (*envsec.Envsec, error)
- func (d *Devbox) Services() (services.Services, error)
- func (d *Devbox) Shell(ctx context.Context, envOpts devopt.EnvOptions) error
- func (d *Devbox) SkipInitHookEnvName() string
- func (d *Devbox) StartProcessManager(ctx context.Context, runInCurrentShell bool, requestedServices []string, ...) error
- func (d *Devbox) StartServices(ctx context.Context, runInCurrentShell bool, serviceNames ...string) error
- func (d *Devbox) Stdenv() flake.Ref
- func (d *Devbox) StopServices(ctx context.Context, runInCurrentShell, allProjects bool, ...) error
- func (d *Devbox) TopLevelPackages() []*devpkg.Package
- func (d *Devbox) UninitializedSecrets(ctx context.Context) *envsec.Envsec
- func (d *Devbox) Update(ctx context.Context, opts devopt.UpdateOpts) error
- func (d *Devbox) UploadProjectToCache(ctx context.Context, cacheURI string) error
- type DevboxShell
- type ShellOption
Constants ¶
const StateOutOfDateMessage = "Your devbox environment may be out of date. Run %s to update it.\n"
Variables ¶
var ErrNoRecognizableShellFound = errors.New("SHELL in undefined, and couldn't find any common shells in PATH")
Functions ¶
func EnsureConfig ¶
func GlobalDataPath ¶
func InitConfig ¶
Types ¶
type Devbox ¶
type Devbox struct {
// contains filtered or unexported fields
}
func (*Devbox) Add ¶
Add adds the `pkgs` to the config (i.e. devbox.json) and nix profile for this devbox project
func (*Devbox) AllPackageNamesIncludingRemovedTriggerPackages ¶
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 ¶
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) AllPackagesIncludingRemovedTriggerPackages ¶
func (*Devbox) AttachToProcessManager ¶
func (*Devbox) ConfigHash ¶
func (*Devbox) EnvExports ¶
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) FixMissingStorePaths ¶
func (*Devbox) GenerateDevcontainer ¶
GenerateDevcontainer generates devcontainer.json and Dockerfile for vscode run-in-container and GitHub Codespaces
func (*Devbox) GenerateDockerfile ¶
GenerateDockerfile generates a Dockerfile that replicates the devbox shell
func (*Devbox) GenerateEnvrcFile ¶
GenerateEnvrcFile generates a .envrc file that makes direnv integration convenient
func (*Devbox) HasDeprecatedPackages ¶
func (*Devbox) Install ¶
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 (*Devbox) InstallablePackages ¶
InstallablePackages returns the packages that are to be installed
func (*Devbox) IsDirenvActive ¶
func (*Devbox) IsEnvEnabled ¶
IsEnvEnabled checks if the devbox environment is enabled. This allows us to differentiate between global and individual project shells.
func (*Devbox) ListScripts ¶
func (*Devbox) ListServices ¶
func (*Devbox) PluginManager ¶
func (*Devbox) ProjectDir ¶
func (*Devbox) ProjectDirHash ¶
func (*Devbox) RefreshAliasOrCommand ¶
In some cases (e.g. 2 non-global projects somehow active at the same time), refresh might not match. This is a tiny edge case, so no need to make UX great, we just print out the entire command.
func (*Devbox) Remove ¶
Remove removes the `pkgs` from the config (i.e. devbox.json) and nix profile for this devbox project
func (*Devbox) RestartServices ¶
func (*Devbox) SkipInitHookEnvName ¶
func (*Devbox) StartProcessManager ¶
func (*Devbox) StartServices ¶
func (*Devbox) StopServices ¶
func (*Devbox) TopLevelPackages ¶
func (*Devbox) UninitializedSecrets ¶
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, envOpts devopt.EnvOptions, 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