devpkg

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: 25 Imported by: 0

Documentation

Index

Constants

View Source
const BinaryCache = "https://cache.nixos.org"

BinaryCache is the store from which to fetch this package's binaries. It is used as FromStore in builtins.fetchClosure.

Variables

View Source
var ErrCannotBuildPackageOnSystem = errors.New("unable to build for system")

Functions

func EnsureNixpkgsPrefetched

func EnsureNixpkgsPrefetched(ctx context.Context, w io.Writer, pkgs []*Package) error

EnsureNixpkgsPrefetched will prefetch flake for the nixpkgs registry for the package. This is an internal method, and should not be called directly.

func FillNarInfoCache

func FillNarInfoCache(ctx context.Context, packages ...*Package) error

FillNarInfoCache checks the remote binary cache for the narinfo of each package in the list, and caches the result. Callers of IsInBinaryCache may call this function first as a perf-optimization.

func IsNix

func IsNix(p *Package, _ int) bool

func IsRunX

func IsRunX(p *Package, _ int) bool

Types

type Package

type Package struct {
	plugins.BuiltIn
	url.URL

	// Raw is the devbox package name from the devbox.json config.
	// Raw has a few forms:
	// 1. Devbox Packages
	//    a. versioned packages
	//       examples:  go@1.20, python@latest
	//    b. any others?
	// 2. Local
	//    flakes in a relative sub-directory
	//    example: ./local_flake_subdir#myPackage
	// 3. Github
	//    remote flakes with raw name starting with `Github:`
	//    example: github:nixos/nixpkgs/5233fd2ba76a3accb5aaa999c00509a11fd0793c#hello
	Raw string
	// contains filtered or unexported fields
}

Package represents a "package" added to the devbox.json config. A unique feature of flakes is that they have well-defined "inputs" and "outputs". This Package will be aggregated into a specific "flake input" (see shellgen.flakeInput).

func PackageFromString

func PackageFromString(raw string, locker lock.Locker) *Package

PackageFromString constructs Package from the raw name provided. The raw name corresponds to a devbox package from the devbox.json config.

func PackageFromStrings

func PackageFromStrings(rawNames []string, l lock.Locker) []*Package

PackageFromStrings constructs Package from the list of package names provided. These names correspond to devbox packages from the devbox.json config.

func PackagesFromConfig

func PackagesFromConfig(config *devconfig.Config, l lock.Locker) []*Package

func (*Package) AllowInsecure

func (p *Package) AllowInsecure() bool

func (*Package) CanonicalName

func (p *Package) CanonicalName() string

CanonicalName returns the name of the package without the version it only applies to devbox packages

func (*Package) EnsureUninstallableIsInLockfile

func (p *Package) EnsureUninstallableIsInLockfile() error

func (*Package) Equals

func (p *Package) Equals(other *Package) bool

Equals compares two Packages. This may be an expensive operation since it may have to normalize a Package's attribute path, which may require a network call.

func (*Package) FlakeInputName

func (p *Package) FlakeInputName() string

FlakeInputName generates a name for the input that will be used in the generated flake.nix to import this package. This name must be unique in that flake so we attach a hash to (quasi) ensure uniqueness. Input name will be different from raw package name

func (*Package) FullPackageAttributePath

func (p *Package) FullPackageAttributePath() (string, error)

FullPackageAttributePath returns the attribute path for a package. It is not always normalized which means it should not be used to compare packages. During happy paths (devbox packages and nix flakes that contains a fragment) it is much faster than NormalizedPackageAttributePath

func (*Package) Hash

func (p *Package) Hash() string

func (*Package) HashFromNixPkgsURL

func (p *Package) HashFromNixPkgsURL() string

func (*Package) InputAddressedPath

func (p *Package) InputAddressedPath() (string, error)

InputAddressedPath is the input-addressed path in /nix/store It is also the key in the BinaryCache for this package

func (*Package) Installable

func (p *Package) Installable() (string, error)

Installable for this package. Installable is a nix concept defined here: https://nixos.org/manual/nix/stable/command-ref/new-cli/nix.html#installables

func (*Package) IsDevboxPackage

func (p *Package) IsDevboxPackage() bool

IsDevboxPackage specifies whether this package is a devbox package. Devbox packages have the format `canonicalName@version`and can be resolved by lockfile.Resolve (including runx packages) This also returns true for legacy packages which are just an attribute path. An explicit flake reference is _not_ a devbox package. TODO: Consider renaming to IsResolvable

func (*Package) IsInBinaryCache

func (p *Package) IsInBinaryCache() (bool, error)

IsInBinaryCache returns true if the package is in the binary cache. ALERT: Callers in a perf-sensitive code path should call FillNarInfoCache before calling this function.

func (*Package) IsInstallable

func (p *Package) IsInstallable() bool

IsInstallable returns whether this package is installable. Not to be confused with the Installable() method which returns the corresponding nix concept.

func (*Package) IsLegacy

func (p *Package) IsLegacy() bool

func (*Package) IsNix

func (p *Package) IsNix() bool

func (*Package) IsRunX

func (p *Package) IsRunX() bool

func (*Package) LegacyToVersioned

func (p *Package) LegacyToVersioned() string

func (*Package) NormalizedDevboxPackageReference

func (p *Package) NormalizedDevboxPackageReference() (string, error)

func (*Package) NormalizedPackageAttributePath

func (p *Package) NormalizedPackageAttributePath() (string, error)

NormalizedPackageAttributePath returns an attribute path normalized by nix search. This is useful for comparing different attribute paths that may point to the same package. Note, it may be an expensive call.

func (*Package) PackageAttributePath

func (p *Package) PackageAttributePath() (string, error)

PackageAttributePath returns the short attribute path for a package which does not include packages/legacyPackages or the system name.

func (*Package) RunXPath

func (p *Package) RunXPath() string

func (*Package) StoreName

func (p *Package) StoreName() (string, error)

StoreName returns the last section of the store path. Example: /nix/store/abc123-foo-1.0.0 -> foo-1.0.0 Warning, this is probably slowish. If you need to call this multiple times, consider caching the result.

func (*Package) URLForFlakeInput

func (p *Package) URLForFlakeInput() string

URLForFlakeInput returns the input url to be used in a flake.nix file. This input can be used to import the package.

func (*Package) ValidateExists

func (p *Package) ValidateExists(ctx context.Context) (bool, error)

func (*Package) ValidateInstallsOnSystem

func (p *Package) ValidateInstallsOnSystem() (bool, error)

func (*Package) Versioned

func (p *Package) Versioned() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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