From 5742f322891d380b15b6570bf523e50c17c45212 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 1 Aug 2017 11:27:03 +0200 Subject: krebs.sitemap: init --- krebs/3modules/default.nix | 6 ++++++ lib/types.nix | 16 +++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/krebs/3modules/default.nix b/krebs/3modules/default.nix index b0ad2baf..abb3d37e 100644 --- a/krebs/3modules/default.nix +++ b/krebs/3modules/default.nix @@ -70,6 +70,12 @@ let type = types.hostname; default = "r"; }; + + sitemap = mkOption { + default = {}; + type = types.attrsOf types.sitemap.entry; + }; + zone-head-config = mkOption { type = with types; attrsOf str; description = '' diff --git a/lib/types.nix b/lib/types.nix index 236190cc..8c684688 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -5,7 +5,7 @@ let all any concatMapStringsSep concatStringsSep const filter flip genid hasSuffix head isInt isString length mergeOneOption mkOption mkOptionType optional optionalAttrs optionals range splitString - stringLength substring test typeOf; + stringLength substring test testString typeOf; inherit (lib.types) attrsOf bool either enum int listOf nullOr path str string submodule; in @@ -357,6 +357,20 @@ rec { pgp-pubkey = str; + sitemap.entry = submodule ({ config, ... }: { + options = { + desc = mkOption { + default = null; + type = nullOr str; + }; + href = mkOption { + ${if testString "https?://.*" config._module.args.name + then "default" else null} = config._module.args.name; + type = nullOr str; # TODO nullOr uri? + }; + }; + }); + ssh-pubkey = str; ssh-privkey = submodule { options = { -- cgit v1.2.3