Documentation
¶
Overview ¶
Package nix validates Nix binary-cache metadata and archive integrity.
Index ¶
- Constants
- Variables
- func ArchivePath(path string) (string, bool)
- func IsInfoPath(path string) bool
- func Nix32(raw []byte) string
- func ReferencedArchive(ctx context.Context, env format.Env, c repo.Config, info Info, cached bool) (types.Item, error)
- func Serves(t repo.PackageType) bool
- type Archive
- type Handler
- func (Handler) Admit(ctx context.Context, env format.Env, c repo.Config, w format.Write) (format.Write, error)
- func (Handler) Classify(_ repo.Config, path string) format.Class
- func (Handler) Deleted(ctx context.Context, env format.Env, c repo.Config, _ []types.Item) error
- func (Handler) Deployed(ctx context.Context, env format.Env, c repo.Config, it types.Item) error
- func (Handler) GuardWrite(ctx context.Context, env format.Env, c repo.Config, w format.Write) error
- func (Handler) Inspect(ctx context.Context, env format.Env, _ repo.Config, w format.Write) (any, error)
- func (Handler) Reindex(ctx context.Context, env format.Env, c repo.Config) error
- func (Handler) Resolve(ctx context.Context, env format.Env, c repo.Config, d format.Download) (string, error)
- type Info
Constants ¶
View Source
const ( MaxMetadataBytes = 1 << 20 MaxArchiveBytes int64 = 512 << 20 MaxNarBytes int64 = 2 << 30 CacheInfo = "StoreDir: /nix/store\nWantMassQuery: 1\nPriority: 30\n" )
Variables ¶
View Source
var (
ErrInvalid = errors.New("nix: invalid binary cache content")
)
Functions ¶
func ArchivePath ¶
ArchivePath admits only relative content-addressed archive names, never URLs.
func IsInfoPath ¶
func ReferencedArchive ¶
func ReferencedArchive( ctx context.Context, env format.Env, c repo.Config, info Info, cached bool, ) (types.Item, error)
ReferencedArchive verifies the complete compressed and uncompressed identity.
func Serves ¶
func Serves(t repo.PackageType) bool
Types ¶
type Archive ¶
Archive describes both the transport bytes and the uncompressed NAR.
func ReadArchive ¶
type Handler ¶
func (Handler) GuardWrite ¶
func (Handler) GuardWrite( ctx context.Context, env format.Env, c repo.Config, w format.Write, ) error
GuardWrite serializes competing first publications at the same store hash. A transfer is admitted while planning, so repeat the fingerprint check under the transaction lock before its destination is replaced.
type Info ¶
type Info struct {
StorePath string `json:"store_path"`
URL string `json:"url"`
Compression string `json:"compression"`
FileHash string `json:"file_hash"`
FileSize int64 `json:"file_size"`
NarHash string `json:"nar_hash"`
NarSize int64 `json:"nar_size"`
References []string `json:"references"`
Deriver string `json:"deriver"`
Signatures []string `json:"signatures"`
}
Info holds the fields covered by a Nix signature and the archive's transport identity.
func (Info) Encode ¶
Encode can rewrite the relative archive URL without changing the signed fingerprint.
func (Info) Fingerprint ¶
Click to show internal directories.
Click to hide internal directories.