dockerTools: use makeOverridable for buildImage family of functions

this allows nix users to modify existing images without having
to rely on container image inheritance mechanisms via fromImage
This commit is contained in:
Robert Scott 2023-01-01 23:43:00 +00:00
parent 63b12f0e0e
commit 38c1400f67

View file

@ -487,7 +487,7 @@ rec {
'';
};
buildLayeredImage = { name, ... }@args:
buildLayeredImage = lib.makeOverridable ({ name, ... }@args:
let
stream = streamLayeredImage args;
in
@ -496,7 +496,8 @@ rec {
inherit (stream) imageName;
passthru = { inherit (stream) imageTag; };
nativeBuildInputs = [ pigz ];
} "${stream} | pigz -nTR > $out";
} "${stream} | pigz -nTR > $out"
);
# 1. extract the base image
# 2. create the layer
@ -504,7 +505,7 @@ rec {
# 4. compute the layer id
# 5. put the layer in the image
# 6. repack the image
buildImage =
buildImage = lib.makeOverridable (
args@{
# Image name.
name
@ -751,7 +752,8 @@ rec {
'';
in
checked result;
checked result
);
# Merge the tarballs of images built with buildImage into a single
# tarball that contains all images. Running `docker load` on the resulting
@ -837,7 +839,7 @@ rec {
})
);
streamLayeredImage =
streamLayeredImage = lib.makeOverridable (
{
# Image Name
name
@ -1046,7 +1048,8 @@ rec {
makeWrapper ${streamScript} $out --add-flags ${conf}
'';
in
result;
result
);
# This function streams a docker image that behaves like a nix-shell for a derivation
streamNixShellImage =