nix2container

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NixLayerAnnotation is a remote snapshot OCI annotation to indicate that
	// it will also contain annotations with NixStorePrefixAnnotation.
	NixLayerAnnotation = "containerd.io/snapshot/nix-layer"

	// NixStorePrefixAnnotation is a prefix for remote snapshot OCI annotations
	// for each nix store path that the layer will need.
	NixStorePrefixAnnotation = "containerd.io/snapshot/nix-store-path."
)

Variables

View Source
var (
	// ImageRefPrefix is part of the canonical image reference for images built
	// for nix-snapshotter in the format "nix:0/nix/store/*.tar".
	//
	// Leading slash is not allowed for image references, so we needed a distinct
	// prefix for nix-snapshotter to distinguish regular references from nix
	// references. If nix-snapshotter is configured as the CRI image service,
	// it will be able to resolve the image manifest with nix rather than a
	// Docker Registry.
	ImageRefPrefix = "nix:0"
)

Functions

func Build

func Build(ctx context.Context, configPath, closurePath, copyToRootPath string, opts ...BuildOpt) (*types.Image, error)

Build builds an image specification.

func Export

func Export(ctx context.Context, store content.Store, image *types.Image, ref string, w io.Writer) error

Export writes an OCI archive to the writer using the provided nix image spec.

func Generate

func Generate(ctx context.Context, image *types.Image, store content.Store) (desc ocispec.Descriptor, err error)

Generate adds a nix-snapshotter container image to store and returns its descriptor.

func Load

func Load(ctx context.Context, client *containerd.Client, archivePath string) (containerd.Image, error)

func Push

func Push(ctx context.Context, store content.Store, archivePath, ref string, opts ...PushOpt) error

Push generates a nix-snapshotter image and pushes it to a remote.

func TempDir

func TempDir() string

TempDir returns the location of a temporary dir or XDG_RUNTIME_DIR if it is defined.

Types

type BuildOpt

type BuildOpt func(*BuildOpts)

BuildOpt applies changes to BuildOptions

func WithFromImage

func WithFromImage(fromImage string) BuildOpt

WithFromImage specifies a base image to build the image from.

type BuildOpts

type BuildOpts struct {
	FromImage string
}

BuildOpts contains options concerning how nix images are built.

type PushConfig

type PushConfig struct {
	PlainHTTP bool
}

type PushOpt

type PushOpt func(*PushConfig)

func WithPlainHTTP

func WithPlainHTTP() PushOpt

Jump to

Keyboard shortcuts

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