mirror of
https://github.com/partofmyid/register.git
synced 2026-06-05 18:46:50 +07:00
feat(nix): recursively import domain files via mapping
This commit is contained in:
parent
08350def49
commit
291bc39a7a
1 changed files with 16 additions and 2 deletions
18
flake.nix
18
flake.nix
|
|
@ -13,6 +13,21 @@
|
||||||
"fattouche.ns.cloudflare.com"
|
"fattouche.ns.cloudflare.com"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
domains = builtins.readDir ./domains;
|
||||||
|
domainFiles = builtins.filterAttrs (
|
||||||
|
name: type: type == "regular" && builtins.match ".*\\.nix" name != null
|
||||||
|
) domains;
|
||||||
|
subdomains = builtins.mapAttrs' (
|
||||||
|
name: _:
|
||||||
|
let
|
||||||
|
key = builtins.replaceStrings [ ".nix" ] [ "" ] name;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
name = key;
|
||||||
|
value = import (./domains + "/${name}") { inherit dns; };
|
||||||
|
}
|
||||||
|
) domainFiles;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
packages.x86_64-linux = builtins.mapAttrs (
|
packages.x86_64-linux = builtins.mapAttrs (
|
||||||
|
|
@ -29,8 +44,7 @@
|
||||||
|
|
||||||
# note: Cloudflare ignores SOA and NS records uploaded via Zone File, they are included just so that dns.nix builds a valid zone file.
|
# note: Cloudflare ignores SOA and NS records uploaded via Zone File, they are included just so that dns.nix builds a valid zone file.
|
||||||
|
|
||||||
#subdomains = ;
|
inherit subdomains;
|
||||||
# ^^ todo: implement file imports from ./domains
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
) domains;
|
) domains;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue