{ 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; }; }