Documentation ¶
Index ¶
- func IsLegacyPackage(pkg string) bool
- func ResolveRunXPackage(ctx context.Context, pkg string) (types.PkgRef, error)
- func SetIgnoreShellMismatch(ignore bool)
- func UpdateAndSaveStateHashFile(args UpdateStateHashFileArgs) error
- type File
- func (f *File) Add(pkgs ...string) error
- func (f *File) FetchResolvedPackage(pkg string) (*Package, error)
- func (f *File) Get(pkg string) *Package
- func (f *File) HasAllowInsecurePackages() bool
- func (f *File) IsUpToDateAndInstalled(isFish bool) (bool, error)
- func (f *File) Remove(pkgs ...string) error
- func (f *File) Resolve(pkg string) (*Package, error)
- func (f *File) Save() error
- func (f *File) SetOutputsForPackage(pkg string, outputs []Output) error
- func (f *File) Stdenv() flake.Ref
- func (f *File) Tidy()
- type Locker
- type Output
- type Package
- type SystemInfo
- type UpdateStateHashFileArgs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsLegacyPackage ¶
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 SetIgnoreShellMismatch ¶
func SetIgnoreShellMismatch(ignore bool)
SetIgnoreShellMismatch is used to disable the shell comparison when checking if the state is up to date. This is useful when we don't load shellrc (e.g. running)
func UpdateAndSaveStateHashFile ¶
func UpdateAndSaveStateHashFile(args UpdateStateHashFileArgs) 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 (*File) FetchResolvedPackage ¶
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) HasAllowInsecurePackages ¶
func (*File) IsUpToDateAndInstalled ¶
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) Resolve ¶
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 ¶
TODO: Consider a design change to have the File struct match disk to make this system easier to reason about, and have isDirty() compare the in-memory struct to the on-disk struct.
Proposal: 1. Have an OutputsRaw field and a method called Outputs() to access it. Outputs() will check if OutputsRaw is zero-value and fills it in from StorePath. 2. Then, in Save(), we can check if OutputsRaw is zero and fill it in prior to writing to disk.
func (*File) SetOutputsForPackage ¶
type Output ¶
type Output struct { // Name is the output's name. Nix appends the name to // the output's store path unless it's the default name // of "out". Output names can be anything, but // conventionally they follow the various "make install" // directories such as "bin", "lib", "src", "man", etc. Name string `json:"name,omitempty"` // Path is the absolute store path (with the /nix/store/ // prefix) of the output. Path string `json:"path,omitempty"` // Default indicates if Nix installs this output by // default. Default bool `json:"default,omitempty"` }
Output refers to a nix package output. This struct is derived from searcher.Output
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) IsAllowInsecure ¶
type SystemInfo ¶
type SystemInfo struct { Outputs []Output `json:"outputs,omitempty"` // Legacy Format StorePath string `json:"store_path,omitempty"` // contains filtered or unexported fields }
func (*SystemInfo) DefaultOutputs ¶
func (i *SystemInfo) DefaultOutputs() []Output
func (*SystemInfo) Equals ¶
func (i *SystemInfo) Equals(other *SystemInfo) bool
func (*SystemInfo) String ¶
func (i *SystemInfo) String() string
Useful for debugging when we print the struct