summaryrefslogtreecommitdiff
path: root/pki/by-path.nix
blob: baca1426e0c7379a2159dda87ea8074cf692c46d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{ 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)));
}