arion/src/nix/modules/composition/service-info.nix
Robert Hensing 7cf74389ad Add build.extendedInfo to service
To let services write to the x-arion section.
2019-03-21 15:15:28 +01:00

24 lines
597 B
Nix

/*
Adds extendedInfo from services to the Docker Compose file.
This contains fields that are not in Docker Compose schema.
*/
{ config, lib, ... }:
let
serviceInfo =
lib.mapAttrs getInfo (
lib.filterAttrs filterFunction config.docker-compose.evaluatedServices
);
filterFunction = _serviceName: service:
# shallow equality suffices for emptiness test
builtins.attrNames service.config.build.extendedInfo != [];
getInfo = _serviceName: service: service.config.build.extendedInfo;
in
{
config = {
docker-compose.extended.serviceInfo = serviceInfo;
};
}