lock

package
v0.0.0-...-b872246 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsLegacyPackage

func IsLegacyPackage(pkg string) bool

This probably belongs in input.go but can't add it there because it will create a circular dependency. We could move Input into own package.

func ResolveRunXPackage

func ResolveRunXPackage(ctx context.Context, pkg string) (types.PkgRef, error)

Types

type File

type File struct {
	LockFileVersion string `json:"lockfile_version"`

	// Packages is keyed by "canonicalName@version"
	Packages map[string]*Package `json:"packages"`
	// contains filtered or unexported fields
}

Lightly inspired by package-lock.json

func GetFile

func GetFile(project devboxProject) (*File, error)

func (*File) Add

func (f *File) Add(pkgs ...string) error

func (*File) FetchResolvedPackage

func (f *File) FetchResolvedPackage(pkg string) (*Package, error)

FetchResolvedPackage fetches a resolution but does not write it to the lock struct. This allows testing new versions of packages without writing to the lock. This is useful to avoid changing nixpkgs commit hashes when version has not changed. This can happen when doing `devbox update` and search has a newer hash than the lock file but same version. In that case we don't want to update because it would be slow and wasteful.

func (*File) ForceResolve

func (f *File) ForceResolve(pkg string) (*Package, error)

func (*File) Get

func (f *File) Get(pkg string) *Package

func (*File) HasAllowInsecurePackages

func (f *File) HasAllowInsecurePackages() bool

func (*File) IsUpToDateAndInstalled

func (f *File) IsUpToDateAndInstalled() (bool, error)

IsUpToDateAndInstalled returns true if the lockfile is up to date and the local hashes match, which generally indicates all packages are correctly installed and print-dev-env has been computed and cached.

func (*File) LegacyNixpkgsPath

func (f *File) LegacyNixpkgsPath(pkg string) string

func (*File) Remove

func (f *File) Remove(pkgs ...string) error

func (*File) Resolve

func (f *File) Resolve(pkg string) (*Package, error)

Resolve updates the in memory copy for performance but does not write to disk This avoids writing values that may need to be removed in case of error.

func (*File) Save

func (f *File) Save() error

func (*File) Tidy

func (f *File) Tidy()

Tidy ensures that the lockfile has the set of packages corresponding to the devbox.json config. It gets rid of older packages that are no longer needed.

type Locker

type Locker interface {
	Get(string) *Package
	LegacyNixpkgsPath(string) string
	ProjectDir() string
	Resolve(string) (*Package, error)
}

type Package

type Package struct {
	AllowInsecure bool   `json:"allow_insecure,omitempty"`
	LastModified  string `json:"last_modified,omitempty"`
	PluginVersion string `json:"plugin_version,omitempty"`
	Resolved      string `json:"resolved,omitempty"`
	Source        string `json:"source,omitempty"`
	Version       string `json:"version,omitempty"`
	// Systems is keyed by the system name
	Systems map[string]*SystemInfo `json:"systems,omitempty"`
}

func (*Package) GetSource

func (p *Package) GetSource() string

func (*Package) IsAllowInsecure

func (p *Package) IsAllowInsecure() bool

type SystemInfo

type SystemInfo struct {
	// StorePath is the input-addressed path for the nix package in /nix/store
	// It is the cache key in the Binary Cache Store (cache.nixos.org)
	// It is of the form /nix/store/<hash>-<name>-<version>
	// <name> may be different from the canonicalName so we store the full store path.
	StorePath string `json:"store_path,omitempty"`
}

func (*SystemInfo) Equals

func (i *SystemInfo) Equals(other *SystemInfo) bool

Jump to

Keyboard shortcuts

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