kubenix/modules/testing/docker.nix
David Arnold b29d3a11b2
testing: rename defaults to common options
They are technically no defaults and competing declarations cause a
module error
2021-05-31 22:36:11 -05:00

47 lines
987 B
Nix

{ config, lib, pkgs, ... }:
with lib;
with import ../../lib/docker { inherit lib pkgs; };
let
testing = config.testing;
allImages = unique (flatten (map (t: t.evaled.config.docker.export or [ ]) testing.tests));
cfg = config.testing.docker;
in
{
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.common = [{
features = [ "docker" ];
options = {
_file = "testing.docker.registryUrl";
docker.registry.url = cfg.registryUrl;
};
}];
}