aboutsummaryrefslogtreecommitdiffstats
path: root/modules/fysiweb-capabilities/default.nix
blob: cbb57eb642dab8f20bec856882e0129e6656597d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{ config, lib, ... }:
let
  allApps = lib.concatMap lib.attrValues (lib.concatMap lib.attrValues (lib.attrValues config.fysiweb-apps));
in
{
  options.fysiweb.capabilities.ssh-credentials = lib.mkOption {
    type = lib.types.attrsOf (lib.types.attrsOf (lib.types.submodule {
      options.publicKeyFile = lib.mkOption {
        type = lib.types.str;
      };
    }));
    default = { };
  };
  config = {
    fysiweb.capabilities.ssh-credentials = lib.listToAttrs (lib.concatMap
      (appConfig:
        let path = (toString ../../apps) + "/${appConfig.appName}/capabilities.nix"; in
        lib.optionals (lib.pathIsRegularFile path) [
          (lib.nameValuePair appConfig.appId
            (import path { inherit appConfig lib; }))
        ])
      allApps);
  };
}