infrastructure/meta/verify.nix

36 lines
829 B
Nix

# Nix expression to check if meta module is evaluating correctly.
# To do so run `nix-build ./verify.nix`
let
sources = import ../npins;
pkgs = import sources.nixpkgs { };
dns = import sources."dns.nix" { inherit pkgs; };
in
{
meta =
let
config = (import ./.) pkgs.lib;
failed = builtins.map (x: "- ${x.message}") (builtins.filter (x: !x.assertion) config.assertions);
in
if (failed != [ ]) then
throw ''
Failed assertions:
${builtins.concatStringsSep "\n" failed}
''
else
pkgs.writers.writeJSON "meta.json" config;
dns = dns.util.writeZone "dgnum.eu" (
pkgs.lib.recursiveUpdate { SOA.serial = 0; } (
import ./dns.nix {
inherit dns;
lib = pkgs.lib // {
extra = import ../lib/nix-lib;
};
}
)
);
}