Documentation ¶
Overview ¶
Package storepath parses and renders Nix store paths.
Index ¶
Constants ¶
View Source
const ( StoreDir = "/nix/store" PathHashSize = 20 )
Variables ¶
View Source
var ( NameRe = regexp.MustCompile(`[a-zA-Z0-9+\-_?=][.a-zA-Z0-9+\-_?=]*`) PathRe = regexp.MustCompile(fmt.Sprintf( `^%v/([%v]{%d})-(%v)$`, regexp.QuoteMeta(StoreDir), nixbase32.Alphabet, nixbase32.EncodedLen(PathHashSize), NameRe, )) )
Functions ¶
Types ¶
type StorePath ¶
StorePath represents a bare Nix store path, without any paths underneath `/nix/store/…-…`.
func FromAbsolutePath ¶
FromAbsolutePath parses an absolute Nix Store path including store prefix) into a StorePath, verifying it's syntactically valid. It returns an error if it fails to parse.
func FromString ¶
FromString parses a Nix store path without store prefix into a StorePath, verifying it's syntactically valid. It returns an error if it fails to parse.
func (*StorePath) Absolute ¶
Absolute returns a StorePath with StoreDir and slash prepended. We use forward slashes on all architectures (including Windows), to be consistent in hashing contexts.
Click to show internal directories.
Click to hide internal directories.