nixprofile

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

Documentation

Index

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.

func ProfileUpgrade

func ProfileUpgrade(ProfileDir string, pkg *devpkg.Package, lock *lock.File) error

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

func (i *NixProfileListItem) Matches(pkg *devpkg.Package, locker lock.Locker) bool

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`

type ProfileInstallArgs

type ProfileInstallArgs struct {
	CustomStepMessage string
	Lockfile          *lock.File
	Package           string
	ProfilePath       string
	Writer            io.Writer
}

type ProfileListIndexArgs

type ProfileListIndexArgs struct {
	// For performance, you can reuse the same list in multiple operations if you
	// are confident index has not changed.
	Items      []*NixProfileListItem
	Lockfile   *lock.File
	Writer     io.Writer
	Package    *devpkg.Package
	ProfileDir string
}

Jump to

Keyboard shortcuts

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