mirror of
https://github.com/partofmyid/register.git
synced 2026-06-05 18:46:50 +07:00
Revert "Nix"
This commit is contained in:
parent
1c04d92eb4
commit
3fac80dcfc
31 changed files with 239 additions and 158 deletions
77
flake.nix
77
flake.nix
|
|
@ -2,53 +2,32 @@
|
|||
description = "Zone File Generator";
|
||||
inputs.dns.url = "github:nix-community/dns.nix";
|
||||
|
||||
outputs =
|
||||
{ dns, ... }:
|
||||
let
|
||||
email = "admin@satr14.my.id";
|
||||
domains."0" = {
|
||||
domain = "part-of.my.id";
|
||||
nameservers = [
|
||||
"adele.ns.cloudflare.com"
|
||||
"fattouche.ns.cloudflare.com"
|
||||
];
|
||||
};
|
||||
|
||||
inherit (import <nixpkgs> { }) lib;
|
||||
|
||||
domainsFolder = builtins.readDir ./domains;
|
||||
domainFiles = lib.filterAttrs (
|
||||
name: type: type == "regular" && builtins.match ".*\\.nix" name != null
|
||||
) domainsFolder;
|
||||
subdomains = lib.mapAttrs' (
|
||||
name: _:
|
||||
let
|
||||
key = builtins.replaceStrings [ ".nix" ] [ "" ] name;
|
||||
in
|
||||
{
|
||||
name = key;
|
||||
value = import (./domains + "/${name}") { inherit dns; };
|
||||
}
|
||||
) domainFiles;
|
||||
in
|
||||
{
|
||||
packages.x86_64-linux = builtins.mapAttrs (
|
||||
_: domain:
|
||||
dns.util.x86_64-linux.writeZone domain.domain (
|
||||
with dns.lib.combinators;
|
||||
{
|
||||
SOA = {
|
||||
adminEmail = email;
|
||||
nameServer = builtins.head domain.nameservers;
|
||||
serial = builtins.currentTime;
|
||||
};
|
||||
NS = domain.nameservers;
|
||||
|
||||
# note: Cloudflare ignores SOA and NS records uploaded via Zone File, they are included just so that dns.nix builds a valid zone file.
|
||||
|
||||
inherit subdomains;
|
||||
}
|
||||
)
|
||||
) domains;
|
||||
outputs = { dns, ... }: let
|
||||
email = "admin@satr14.my.id";
|
||||
domains."0" = {
|
||||
domain = "part-of.my.id";
|
||||
nameservers = [
|
||||
"adele.ns.cloudflare.com"
|
||||
"fattouche.ns.cloudflare.com"
|
||||
];
|
||||
};
|
||||
}
|
||||
in {
|
||||
packages.x86_64-linux = builtins.mapAttrs (_: domain:
|
||||
dns.util.x86_64-linux.writeZone domain.domain (
|
||||
with dns.lib.combinators; {
|
||||
SOA = {
|
||||
adminEmail = email;
|
||||
nameServer = builtins.head domain.nameservers;
|
||||
serial = builtins.currentTime;
|
||||
};
|
||||
NS = domain.nameservers;
|
||||
|
||||
# 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 = ;
|
||||
# ^^ todo: implement file imports from ./domains
|
||||
}
|
||||
)
|
||||
) domains;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue