nixutil

package
v0.0.0-...-3288d0b Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2023 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChannelSourcePath

func ChannelSourcePath(ctx context.Context, channelName string) (string, error)

ChannelSourcePath resolves the /nix/store path of the channel with the given name.

func Eval

func Eval(ctx context.Context, out interface{}, expr string) error

Eval uses nix-instantiate to evaluate a Nix expression.

func StoreDir

func StoreDir() (string, error)

StoreDir retrieves the Nix store directory. It is usually /nix/store but can technically be different.

func StoreDirUncached

func StoreDirUncached(ctx context.Context) (string, error)

StoreDirUncached retrieves the Nix store directory without using the cache.

Types

type StoreHash

type StoreHash string

StoreHash is the string hash part of the /nix/store string.

func (StoreHash) Decode

func (h StoreHash) Decode() ([]byte, error)

Decode decodes the store hash to its raw digest.

type StorePath

type StorePath struct {
	Root string
	Name string
	Hash StoreHash
}

StorePath is the checksum string extracted from the /nix/store path.

func LocatePath

func LocatePath(hash StoreHash) (StorePath, error)

LocatePath locates the Nix store directory matching the given hash.

func LocatePathWithRoot

func LocatePathWithRoot(root string, hash StoreHash) (StorePath, error)

LocatePathWithRoot locates the Nix store directory matching the given hash within the given root directory.

func ParseStorePath

func ParseStorePath(path string) (StorePath, error)

ParseStorePath parses the given path within /nix/store as a Nix StorePath.

func ParseStorePathWithRoot

func ParseStorePathWithRoot(root, path string) (StorePath, error)

ParseStorePathWithRoot parses the given path within the root directory as a Nix StorePath.

func (StorePath) String

func (p StorePath) String() string

String formats the path into /nix/store/X.

Jump to

Keyboard shortcuts

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