build-support/docker: use runCommand in make-layers.nix

This commit is contained in:
Adrian Gierakowski 2024-11-29 21:59:36 +00:00
parent 88bdfb1565
commit 266283bec3

View File

@ -3,7 +3,7 @@
flattenReferencesGraph,
lib,
jq,
stdenvNoCC,
runCommand,
}:
{
closureRoots,
@ -16,17 +16,21 @@
if closureRoots == [ ] then
builtins.toFile "docker-layers-empty" "[]"
else
stdenvNoCC.mkDerivation {
name = "docker-layers";
__structuredAttrs = true;
# graph, exclude_paths and pipeline are expected by the
# flatten_references_graph executable.
exportReferencesGraph.graph = closureRoots;
exclude_paths = excludePaths;
inherit pipeline;
# builder cannot refer to derivation outputs
PATH = "${coreutils}/bin:${flattenReferencesGraph}/bin:${jq}/bin";
builder = builtins.toFile "docker-make-layers-builder" ''
runCommand "docker-layers"
{
__structuredAttrs = true;
# graph, exclude_paths and pipeline are expected by the
# flatten_references_graph executable.
exportReferencesGraph.graph = closureRoots;
exclude_paths = excludePaths;
inherit pipeline;
nativeBuildInputs = [
coreutils
flattenReferencesGraph
jq
];
}
''
. .attrs.sh
flatten_references_graph_arg=.attrs.json
@ -43,5 +47,4 @@ else
${lib.optionalString debug "export DEBUG=True"}
flatten_references_graph "$flatten_references_graph_arg" > ''${outputs[out]}
'';
}
''