# 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 { };
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;

}