arion/src/nix/modules/composition/service-info.nix

25 lines
597 B
Nix
Raw Normal View History

/*
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;
};
}