nix

package
v0.0.0-...-841f565 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const Type = "nix"

Type is the string value of the Target type

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Artifact *Artifact
	Target   *Target
	Logger   logz.FieldLogger
}

Action is the executor for installing a nix package

func (Action) Execute

func (a Action) Execute(_ context.Context) (err error)

Execute runs the action and produces a nix.Artifact

func (*Action) UseLogger

func (a *Action) UseLogger(logger logz.FieldLogger)

UseLogger injects a logger into the target's action

type Artifact

type Artifact struct {
	ark.RawArtifact `mapstructure:",squash"`
	Packages        []string `json:"packages" mapstructure:"packages"`
}

Artifact is the result of a successful nix.Produce() call

func (Artifact) Cacheable

func (a Artifact) Cacheable() bool

Cacheable returns true because a local nix store might have the package(s) installed, but remote caching checks will always return false

func (Artifact) LocallyCached

func (a Artifact) LocallyCached(_ context.Context) (bool, error)

LocallyCached queries the local nix store for the packages expressed in the target definition

func (Artifact) Pull

func (a Artifact) Pull(_ context.Context) error

Pull does nothing because this target will never pass a remote cache check

func (Artifact) Push

func (a Artifact) Push(_ context.Context) error

Push does nothing because this target does not push artifact to a remote cache

func (Artifact) RemotelyCached

func (a Artifact) RemotelyCached(_ context.Context) (bool, error)

RemotelyCached always returns false because if a package isn't locally cached, we should just install it using nix

type NxPkg

type NxPkg struct {
	Name    string `json:"name"`
	Pname   string `json:"pname"`
	Version string `json:"version"`
	System  string `json:"system"`
}

NxPkg is a container for unmarshalled nix query responses

type Target

type Target struct {
	ark.RawTarget `mapstructure:",squash"`
	Packages      []string `json:"packages" mapstructure:"packages"`
}

Target expresses the intention to install one or more nix packages

func (*Target) Produce

func (t *Target) Produce(checksum hash.Hash) (ark.Artifact, error)

Produce should produce Artifact

func (*Target) Validate

func (t *Target) Validate() error

Validate checks if the Target fields are valid

Jump to

Keyboard shortcuts

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