nix

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotInitialized = errors.New("Nix-snapshotter Image Service not yet initialized")
)

Functions

func NewImageService

func NewImageService(ctx context.Context, containerdAddr string, opts ...ImageServiceOpt) (runtime.ImageServiceServer, error)

func NewSnapshotter

func NewSnapshotter(root string, opts ...SnapshotterOpt) (snapshots.Snapshotter, error)

NewSnapshotter returns a Snapshotter which uses overlayfs. The overlayfs diffs are stored under the provided root. A metadata file is stored under the root.

func Supported added in v0.1.2

func Supported(root string) error

Supported returns nil when the remote snapshotter is functional on the system with the root directory. Supported is not called during plugin initialization, but exposed for downstream projects which uses this snapshotter as a library.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config is used to configure common options.

type ImageServiceConfig

type ImageServiceConfig struct {
	Config
}

ImageServiceConfig is used to configure the image service instance.

type ImageServiceOpt

type ImageServiceOpt interface {
	SetImageServiceOpt(cfg *ImageServiceConfig)
}

ImageServiceOpt is an option for NewImageService.

type NixBuilder

type NixBuilder func(ctx context.Context, outLink, nixStorePath string) error

NixBuilder is a function that is able to substitute a nix store path and optionally create an out-link. outLink may be empty in which case out-links are not needed.

Typically this is implemented by `nix build --out-link ${outLink} ${nixStorePath}`, however it can also be done by `nix copy` and alternate implementations.

func NewExternalBuilder added in v0.1.2

func NewExternalBuilder(name string) NixBuilder

NewExternalBuilder returns a NixBuilder from an external executable with two arguments: an out-link path, and a Nix store path.

type Opt

type Opt interface {
	SnapshotterOpt
	ImageServiceOpt
}

Opt is a common option for nix related services.

func WithNixBuilder

func WithNixBuilder(nixBuilder NixBuilder) Opt

WithNixBuilder is an option to override the default NixBuilder.

type SnapshotterConfig

type SnapshotterConfig struct {
	Config
	// contains filtered or unexported fields
}

SnapshotterConfig is used to configure the nix snapshotter instance.

type SnapshotterOpt

type SnapshotterOpt interface {
	SetSnapshotterOpt(sc *SnapshotterConfig)
}

SnapshotterOpt is an option for NewSnapshotter.

func WithFuseOverlayfs

func WithFuseOverlayfs() SnapshotterOpt

WithFuseOverlayfs changes the overlay mount type used to fuse-overlayfs, an FUSE implementation for overlayfs.

See: https://github.com/containers/fuse-overlayfs

func WithOverlayOpts

func WithOverlayOpts(opts ...overlay.Opt) SnapshotterOpt

WithOverlayOpts provides overlay options to the embedded overlay snapshotter.

Jump to

Keyboard shortcuts

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