summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorAntoine Eiche <lewo@abesis.fr>2020-01-30 10:43:15 +0100
committerAntoine Eiche <lewo@abesis.fr>2020-01-30 21:09:52 +0100
commit01a68479cc08d4f937a93c27f8f36e701e4bd435 (patch)
tree4433cb43bc87764ae012e3bc3ddc2f207735481b /pkgs/build-support
parent283bcc1003c9cdabbbbe8d117b66d8dec6b46af9 (diff)
downloadnixpkgs-01a68479cc08d4f937a93c27f8f36e701e4bd435.tar
nixpkgs-01a68479cc08d4f937a93c27f8f36e701e4bd435.tar.gz
nixpkgs-01a68479cc08d4f937a93c27f8f36e701e4bd435.tar.bz2
nixpkgs-01a68479cc08d4f937a93c27f8f36e701e4bd435.tar.lz
nixpkgs-01a68479cc08d4f937a93c27f8f36e701e4bd435.tar.xz
nixpkgs-01a68479cc08d4f937a93c27f8f36e701e4bd435.tar.zst
nixpkgs-01a68479cc08d4f937a93c27f8f36e701e4bd435.zip
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)
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/docker/default.nix3
1 files changed, 3 insertions, 0 deletions
diff --git a/pkgs/build-support/docker/default.nix b/pkgs/build-support/docker/default.nix
index 9f831d48bfa..509b7e2a7e1 100644
--- a/pkgs/build-support/docker/default.nix
+++ b/pkgs/build-support/docker/default.nix
@@ -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 {