kubenix/modules/testing/docker.nix

51 lines
1,008 B
Nix
Raw Normal View History

2022-04-02 12:40:35 -07:00
{
config,
lib,
pkgs,
...
}:
2020-04-05 21:25:34 +07:00
with lib;
2022-04-02 12:40:35 -07:00
with import ../../lib/docker {inherit lib pkgs;}; let
2020-04-05 21:25:34 +07:00
testing = config.testing;
2022-04-02 12:40:35 -07:00
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;
2022-04-02 12:40:35 -07: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;
};
};
2022-04-02 12:40:35 -07:00
config.testing.common = [
{
features = ["docker"];
options = {
_file = "testing.docker.registryUrl";
docker.registry.url = cfg.registryUrl;
};
}
];
2020-04-05 21:25:34 +07:00
}