Documentation ¶
Overview ¶
Copyright 2022 The TVL Contributors SPDX-License-Identifier: Apache-2.0
Package builder implements the logic for assembling container images. It shells out to Nix to retrieve all required Nix-packages and assemble the symlink layer and then creates the required tarballs in-process.
Copyright 2022 The TVL Contributors SPDX-License-Identifier: Apache-2.0
Index ¶
Constants ¶
const LayerBudget int = 94
The maximum number of layers in an image is 125. To allow for extensibility, the actual number of layers Nixery is "allowed" to use up is set at a lower point.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Architecture ¶
type Architecture struct {
// contains filtered or unexported fields
}
Architecture represents the possible CPU architectures for which container images can be built.
The default architecture is amd64, but support for ARM platforms is available within nixpkgs and can be toggled via meta-packages.
type BuildResult ¶
type BuildResult struct { Error string `json:"error"` Pkgs []string `json:"pkgs"` Manifest json.RawMessage `json:"manifest"` }
BuildResult represents the data returned from the server to the HTTP handlers. Error information is propagated straight from Nix for errors inside of the build that should be fed back to the client (such as missing packages).
func BuildImage ¶
type Image ¶
type Image struct { Name string Tag string // Names of packages to include in the image. These must correspond // directly to top-level names of Nix packages in the nixpkgs tree. Packages []string // Architecture for which to build the image. Nixery defaults // this to amd64 if not specified via meta-packages. Arch *Architecture }
Image represents the information necessary for building a container image. This can be either a list of package names (corresponding to keys in the nixpkgs set) or a Nix expression that results in a *list* of derivations.
func ImageFromName ¶
ImageFromName parses an image name into the corresponding structure which can be used to invoke Nix.
It will expand convenience names under the hood (see the `convenienceNames` function below) and append packages that are always included (cacert, iana-etc).
Once assembled the image structure uses a sorted representation of the name. This is to avoid unnecessarily cache-busting images if only the order of requested packages has changed.
type ImageResult ¶
type ImageResult struct { // These fields are populated in case of an error Error string `json:"error"` Pkgs []string `json:"pkgs"` // These fields are populated in case of success Graph layers.RuntimeGraph `json:"runtimeGraph"` SymlinkLayer struct { Size int `json:"size"` TarHash string `json:"tarHash"` Path string `json:"path"` } `json:"symlinkLayer"` }
ImageResult represents the output of calling the Nix derivation responsible for preparing an image.
type LocalCache ¶
type LocalCache struct {
// contains filtered or unexported fields
}
LocalCache implements the structure used for local caching of manifests and layer uploads.
func NewCache ¶
func NewCache() (LocalCache, error)
Creates an in-memory cache and ensures that the local file path for manifest caching exists.