nar

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidURL is returned if the regexp did not match the given URL.
	ErrInvalidURL = errors.New("invalid nar URL")
)
View Source
var ErrUnknownFileExtension = errors.New("file extension is not known")

ErrUnknownFileExtension is returned if the file extension is not known.

Functions

This section is empty.

Types

type CompressionType

type CompressionType string

CompressionType represents the compression types supported by Nix. See: https://github.com/NixOS/nix/blob/f1187cb696584739884687d788a6fbb4dd36c61c/src/libstore/binary-cache-store.cc#L166

const (
	CompressionTypeNone  CompressionType = "none"
	CompressionTypeBzip2 CompressionType = "bzip2"
	CompressionTypeZstd  CompressionType = "zstd"
	CompressionTypeLzip  CompressionType = "lzip"
	CompressionTypeLz4   CompressionType = "lz4"
	CompressionTypeBr    CompressionType = "br"
	CompressionTypeXz    CompressionType = "xz"
)

func CompressionTypeFromExtension

func CompressionTypeFromExtension(ext string) (CompressionType, error)

CompressionTypeFromExtension returns the compression type given an extension.

func CompressionTypeFromString

func CompressionTypeFromString(ct string) CompressionType

CompressionTypeFromString returns the string compression type as CompressionType.

func (CompressionType) String

func (ct CompressionType) String() string

String returns the CompressionType as a string.

func (CompressionType) ToFileExtension

func (ct CompressionType) ToFileExtension() string

ToFileExtension returns the file extensions associated with the compression type.

type URL

type URL struct {
	Hash        string
	Compression CompressionType
	Query       url.Values
}

URL represents a nar URL.

func ParseURL

func ParseURL(u string) (URL, error)

ParseURL parses a nar URL (as present in narinfo) and returns its components.

func (URL) JoinURL

func (u URL) JoinURL(uri *url.URL) *url.URL

JoinURL returns a new URL combined with the given URL.

func (URL) NewLogger

func (u URL) NewLogger(log zerolog.Logger) zerolog.Logger

NewLogger returns a new logger with the right fields.

func (URL) String

func (u URL) String() string

String returns the URL as a string.

func (URL) ToFilePath

func (u URL) ToFilePath() string

ToFilePath returns the filepath in the store for a given nar URL.

Jump to

Keyboard shortcuts

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