dockerTools.buildLayeredImage: assert maxLayers > 1

Since a layer is reserved for "customization", the image can not
contains less than 2 layers.

The user gets the following message at evaluation:

    nix-instantiate nixos/tests/docker-tools.nix
    trace: the maxLayers argument of dockerTools.buildLayeredImage function must be greather than 1 (current value: 1)
This commit is contained in:
Antoine Eiche 2020-01-30 10:43:15 +01:00
parent 283bcc1003
commit 01a68479cc

View File

@ -545,6 +545,9 @@ rec {
# believe the actual maximum is 128.
maxLayers ? 100
}:
assert
(lib.assertMsg (maxLayers > 1)
"the maxLayers argument of dockerTools.buildLayeredImage function must be greather than 1 (current value: ${toString maxLayers})");
let
baseName = baseNameOf name;
contentsEnv = symlinkJoin {