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