{ config, lib, ... }: with lib; { options.local.pki.byPath = mkOption { type = with lib.types; attrsOf unspecified; readOnly = true; }; config.local.pki.byPath = let caWithLeaves = ca: singleton { "${ca.path}" = ca; } ++ map (leaf: { "${leaf.path}" = leaf; }) (attrValues ca.leaves); in mergeAttrsList (flatten (map caWithLeaves (attrValues config.local.pki.ca))); }