Documentation ¶
Overview ¶
Package nixpath 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 ¶
func Absolute ¶
Absolute prefixes a nixpath name with StoreDir and a '/', and cleans the path. It does not prevent from leaving StoreDir, so check if it still starts with StoreDir if you accept untrusted input. This should be used when assembling store paths in hashing contexts. Even if this code is running on windows, we want to use forward slashes to construct them.
Types ¶
type NixPath ¶
NixPath represents a bare nix store path, without any paths underneath `/nix/store/…-…`.
func FromString ¶
FromString parses a path string into a nix path, verifying it's syntactically valid It returns an error if it fails to parse.
Click to show internal directories.
Click to hide internal directories.