refactor(nixery): Extract layering logic into separate package

This will be required for making a standalone, Nixery-style image
builder function usable from Nix.

Change-Id: I5e36348bd4c32d249d56f6628cd046916691319f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5601
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
Vincent Ambo 2022-05-13 17:54:06 +02:00 committed by tazjin
parent d60feb21e8
commit 796ff086be
4 changed files with 25 additions and 21 deletions

View file

@ -16,6 +16,8 @@ import (
"io"
"os"
"path/filepath"
"github.com/google/nixery/layers"
)
// Create a new compressed tarball from each of the paths in the list
@ -23,7 +25,7 @@ import (
//
// The uncompressed tarball is hashed because image manifests must
// contain both the hashes of compressed and uncompressed layers.
func packStorePaths(l *layer, w io.Writer) (string, error) {
func packStorePaths(l *layers.Layer, w io.Writer) (string, error) {
shasum := sha256.New()
gz := gzip.NewWriter(w)
multi := io.MultiWriter(shasum, gz)