Documentation ¶
Index ¶
- func ProfileInstall(ctx context.Context, args *ProfileInstallArgs) error
- func ProfileListIndex(args *ProfileListIndexArgs) (int, error)
- func ProfileRemoveItems(profilePath string, items []*NixProfileListItem) error
- func ProfileUpgrade(ProfileDir string, pkg *devpkg.Package, lock *lock.File) error
- type NixProfileListItem
- type ProfileInstallArgs
- type ProfileListIndexArgs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProfileInstall ¶
func ProfileInstall(ctx context.Context, args *ProfileInstallArgs) error
ProfileInstall calls nix profile install with default profile
func ProfileListIndex ¶
func ProfileListIndex(args *ProfileListIndexArgs) (int, error)
ProfileListIndex returns the index of args.Package in the nix profile specified by args.ProfileDir, or -1 if it's not found. Callers can pass in args.Items to avoid having to call `nix-profile list` again.
func ProfileRemoveItems ¶
func ProfileRemoveItems(profilePath string, items []*NixProfileListItem) error
ProfileRemoveItems removes the items from the profile, in a single call, using their indexes. It is up to the caller to ensure that the underlying profile has not changed since the items were queried.
Types ¶
type NixProfileListItem ¶
type NixProfileListItem struct {
// contains filtered or unexported fields
}
NixProfileListItem is a go-struct of a line of printed output from `nix profile list` docs: https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-profile-list.html
func ProfileListItems ¶
func ProfileListItems( writer io.Writer, profileDir string, ) ([]*NixProfileListItem, error)
ProfileListItems returns a list of the installed packages.
func (*NixProfileListItem) AttributePath ¶
func (i *NixProfileListItem) AttributePath() (string, error)
AttributePath parses the package attribute from the NixProfileListItem.lockedReference
For example: if NixProfileListItem.lockedReference = github:NixOS/nixpkgs/52e3e80afff4b16ccb7c52e9f0f5220552f03d04#legacyPackages.x86_64-darwin.go_1_19 then AttributePath = legacyPackages.x86_64-darwin.go_1_19
func (*NixProfileListItem) Matches ¶
Matches compares a devpkg.Package with this profile item and returns true if the profile item was the result of adding the Package to the nix profile.
func (*NixProfileListItem) String ¶
func (i *NixProfileListItem) String() string
String serializes the NixProfileListItem back into the format printed by `nix profile list`