run nixfmt
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
{ pkgs, lib, config, ... }:
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.services.octodns;
|
||||
secrets = config.age.secrets;
|
||||
@@ -125,37 +130,46 @@ let
|
||||
|
||||
yamlFormat = pkgs.formats.yaml { };
|
||||
|
||||
zoneFile = yamlFormat.generate "octodns-zone"
|
||||
(
|
||||
lib.filterAttrs (_: records: (lib.length records) > 0)
|
||||
(lib.mapAttrs
|
||||
(_: types:
|
||||
lib.filter
|
||||
({ values ? [ ], value ? null, ... }: (lib.length values) > 0 || !(builtins.isNull value))
|
||||
(lib.mapAttrsToList
|
||||
(type: { ttl, ... }@options:
|
||||
if (type == "CNAME")
|
||||
then
|
||||
let
|
||||
inherit (options) target toRoot;
|
||||
value = if toRoot then "${config.networking.domain}." else target;
|
||||
in
|
||||
{ inherit type ttl value; }
|
||||
else
|
||||
{ inherit type ttl; inherit (options) values; }
|
||||
)
|
||||
types
|
||||
)
|
||||
zoneFile = yamlFormat.generate "octodns-zone" (
|
||||
lib.filterAttrs (_: records: (lib.length records) > 0) (
|
||||
lib.mapAttrs (
|
||||
_: types:
|
||||
lib.filter
|
||||
(
|
||||
{
|
||||
values ? [ ],
|
||||
value ? null,
|
||||
...
|
||||
}:
|
||||
(lib.length values) > 0 || !(builtins.isNull value)
|
||||
)
|
||||
cfg.records
|
||||
)
|
||||
);
|
||||
(
|
||||
lib.mapAttrsToList (
|
||||
type:
|
||||
{ ttl, ... }@options:
|
||||
if (type == "CNAME") then
|
||||
let
|
||||
inherit (options) target toRoot;
|
||||
value = if toRoot then "${config.networking.domain}." else target;
|
||||
in
|
||||
{
|
||||
inherit type ttl value;
|
||||
}
|
||||
else
|
||||
{
|
||||
inherit type ttl;
|
||||
inherit (options) values;
|
||||
}
|
||||
) types
|
||||
)
|
||||
) cfg.records
|
||||
)
|
||||
);
|
||||
|
||||
zonesDir = pkgs.linkFarm "octodns-zones" {
|
||||
"${config.networking.domain}.yaml" = zoneFile;
|
||||
};
|
||||
|
||||
|
||||
configFile = yamlFormat.generate "octodns-config.yaml" {
|
||||
providers = {
|
||||
config = {
|
||||
|
||||
Reference in New Issue
Block a user