feat: initial docker image module

This commit is contained in:
Jaka Hudoklin 2019-03-05 21:26:00 +01:00
parent aab68623e0
commit 03e1f4c1c4
No known key found for this signature in database
GPG key ID: 6A08896BFD32BD95
2 changed files with 52 additions and 0 deletions

View file

@ -5,4 +5,5 @@
istio = ./istio; istio = ./istio;
testing = ./testing; testing = ./testing;
helm = ./helm; helm = ./helm;
docker = ./docker;
} }

View file

@ -0,0 +1,51 @@
{ config, lib, ... }:
with lib;
{
options.docker.registry.url = mkOption {
description = "Default registry url where images are published";
type = types.str;
};
options.docker.images = mkOption {
description = "Attribute set of docker images that should be published";
type = types.attrsOf (types.submodule ({ name, config, ... }: {
options = {
image = mkOption {
description = "Docker image to publish";
type = types.nullOr types.package;
default = null;
};
name = mkOption {
description = "Desired docker image name";
type = types.str;
default = builtins.unsafeDiscardStringContext config.image.imageName;
};
tag = mkOption {
description = "Desired docker image tag";
type = types.str;
default = builtins.unsafeDiscardStringContext config.image.imageTag;
};
registry = mkOption {
description = "Docker registry url where image is published";
type = types.str;
default = config.docker.registry.url;
};
};
}));
default = {};
};
options.docker.push = mkOption {
description = "List of images to push";
type = types.listOf (types.package);
default = [];
};
config.docker.push = mapAttrsToList (_: i: i.image)
(filterAttrs (_: i: i.registry != null)config.docker.images);
}