kubenix/modules/testing/docker.nix

45 lines
986 B
Nix
Raw Normal View History

2023-07-07 22:01:34 -04:00
{ config, lib, pkgs, ... }:
2020-04-05 21:25:34 +07:00
with lib;
2023-07-07 22:01:34 -04:00
with import ../../lib/docker { inherit lib pkgs; }; let
2022-04-02 13:43:57 -07:00
inherit (config) testing;
2020-04-05 21:25:34 +07:00
2023-07-07 22:01:34 -04: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;
2023-07-07 22:01:34 -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 {
2022-04-02 13:43:57 -07:00
inherit (cfg) images;
2020-04-05 21:25:34 +07:00
dest = "docker://" + cfg.registryUrl;
};
};
2023-07-07 22:01:34 -04:00
config.testing.common = [{
features = [ "docker" ];
options = {
_file = "testing.docker.registryUrl";
docker.registry.url = cfg.registryUrl;
};
}];
2020-04-05 21:25:34 +07:00
}