diff options
author | Alexander Foremny <aforemny@posteo.de> | 2024-02-23 08:07:11 +0100 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2024-02-26 04:36:24 +0100 |
commit | 597ec76b7cb1527b1df215548a8f50bddccd8606 (patch) | |
tree | 9ea88686f3b15689e222a1d286a6726f6ce59ace /modules | |
parent | d2873fe0f6a117d7157c2a6f204a864f9edeb668 (diff) |
apps/authelia: init
Diffstat (limited to 'modules')
-rw-r--r-- | modules/fysiweb-capabilities/default.nix | 17 | ||||
-rw-r--r-- | modules/fysiweb-host-modules/default.nix | 14 | ||||
-rw-r--r-- | modules/fysiweb-secrets/default.nix | 27 |
3 files changed, 55 insertions, 3 deletions
diff --git a/modules/fysiweb-capabilities/default.nix b/modules/fysiweb-capabilities/default.nix index cbb57eb..bf1937b 100644 --- a/modules/fysiweb-capabilities/default.nix +++ b/modules/fysiweb-capabilities/default.nix @@ -3,6 +3,17 @@ let allApps = lib.concatMap lib.attrValues (lib.concatMap lib.attrValues (lib.attrValues config.fysiweb-apps)); in { + options.fysiweb.capabilities.password-credentials = lib.mkOption { + type = lib.types.attrsOf (lib.types.attrsOf (lib.types.submodule { + options.username = lib.mkOption { + type = lib.types.str; + }; + options.passwordFile = lib.mkOption { + type = lib.types.str; + }; + })); + default = { }; + }; options.fysiweb.capabilities.ssh-credentials = lib.mkOption { type = lib.types.attrsOf (lib.types.attrsOf (lib.types.submodule { options.publicKeyFile = lib.mkOption { @@ -12,12 +23,12 @@ in default = { }; }; config = { - fysiweb.capabilities.ssh-credentials = lib.listToAttrs (lib.concatMap + fysiweb.capabilities = lib.attrsets.mergeAttrsList (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; })) + (lib.mapAttrs (_: value: { ${appConfig.appId} = value; }) + (import path { inherit appConfig config lib; })) ]) allApps); }; diff --git a/modules/fysiweb-host-modules/default.nix b/modules/fysiweb-host-modules/default.nix new file mode 100644 index 0000000..d38ba9f --- /dev/null +++ b/modules/fysiweb-host-modules/default.nix @@ -0,0 +1,14 @@ +{ config, lib, ... }: +let + allApps = lib.concatMap lib.attrValues (lib.concatMap lib.attrValues (lib.attrValues config.fysiweb-apps)); +in +{ + config = lib.mkMerge (map + (appConfig: + let path = (toString ../../apps) + "/${appConfig.appName}/host-module.nix"; in + lib.optionalAttr (lib.pathIsRegularFile path) { } + #(import path { }) + ) + #allApps); + [ ]); +} diff --git a/modules/fysiweb-secrets/default.nix b/modules/fysiweb-secrets/default.nix new file mode 100644 index 0000000..e494dde --- /dev/null +++ b/modules/fysiweb-secrets/default.nix @@ -0,0 +1,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; + }; +} |