aboutsummaryrefslogtreecommitdiffstats
path: root/modules/fysiweb-secrets/default.nix
blob: e494ddeaf2d6b8707edf34f886051f630f86ba87 (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
25
26
27
{ config, lib, ... }:
let
  allApps = lib.concatMap lib.attrValues (lib.concatMap lib.attrValues (lib.attrValues config.fysiweb-apps));
in
{
  options.fysiweb.secrets = lib.mkOption {
    type = lib.types.listOf (lib.types.submodule {
      options = {
        type = lib.mkOption {
          type = lib.types.enum [ "random-string" ];
        };
        path = lib.mkOption {
          type = lib.types.str;
        };
      };
    });
    default = [ ];
  };
  config = {
    fysiweb.secrets = lib.concatMap
      (appConfig:
        let path = (toString ../../apps) + "/${appConfig.appName}/secrets.nix"; in
        lib.optionals (lib.pathIsRegularFile path)
          (import path { inherit appConfig lib; }))
      allApps;
  };
}