kubenix/modules/testing/docker.nix

47 lines
946 B
Nix
Raw Normal View History

2020-04-05 21:25:34 +07:00
{ config, lib, pkgs, ... }:
with lib;
2021-05-28 16:19:03 -05:00
with import ../../lib/docker { inherit lib pkgs; };
2020-04-05 21:25:34 +07:00
let
testing = config.testing;
allImages = unique ( flatten (map (t: t.evaled.config.docker.export or [ ]) testing.tests));
2020-04-05 21:25:34 +07:00
cfg = config.testing.docker;
2021-05-13 17:27:08 -04:00
in
{
2020-04-05 21:25:34 +07:00
options.testing.docker = {
registryUrl = mkOption {
description = "Docker registry url";
type = types.str;
};
images = mkOption {
description = "List of images to export";
type = types.listOf types.package;
};
copyScript = mkOption {
description = "Script to copy images to registry";
type = types.package;
};
};
config.testing.docker = {
images = allImages;
copyScript = copyDockerImages {
images = cfg.images;
dest = "docker://" + cfg.registryUrl;
};
};
config.testing.defaults = [{
2021-05-13 17:27:08 -04:00
features = [ "docker" ];
2020-04-05 21:25:34 +07:00
default = {
docker.registry.url = cfg.registryUrl;
};
}];
}