forked from Fediversity/Fediversity
70 lines
1.8 KiB
Nix
70 lines
1.8 KiB
Nix
let
|
|
inherit (import ../default.nix { }) pkgs;
|
|
inherit (pkgs) lib;
|
|
eval =
|
|
module:
|
|
(lib.evalModules {
|
|
modules = [
|
|
module
|
|
./data-model.nix
|
|
];
|
|
}).config;
|
|
in
|
|
{
|
|
_class = "nix-unit";
|
|
|
|
test-eval = {
|
|
expr =
|
|
let
|
|
example = eval (
|
|
{ config, ... }:
|
|
let
|
|
inherit (config.resources.bar.runtime-environment) runtime-environment;
|
|
in
|
|
{
|
|
providers.ssh-host =
|
|
{ ... }:
|
|
{
|
|
system.stateVersion = "25.05";
|
|
};
|
|
resources.bar.runtime-environment.ssh-host = {
|
|
ssh = {
|
|
host = "localhost";
|
|
username = "root";
|
|
authentication.password = "";
|
|
};
|
|
};
|
|
applications.foo.module =
|
|
{ pkgs, ... }:
|
|
{
|
|
environment.systemPackages = [
|
|
pkgs.hello
|
|
];
|
|
};
|
|
deployments.baz = {
|
|
module = { };
|
|
inherit runtime-environment;
|
|
};
|
|
migrations.boo = {
|
|
inherit runtime-environment;
|
|
deployment = config.deployments.baz;
|
|
};
|
|
}
|
|
);
|
|
in
|
|
{
|
|
has-provider = lib.isAttrs example.providers.ssh-host;
|
|
has-resource = lib.isAttrs example.resources.bar.runtime-environment.ssh-host.module;
|
|
has-application = lib.isAttrs example.applications.foo.module;
|
|
has-deployment = lib.isAttrs example.deployments.baz.module;
|
|
has-migration = lib.isAttrs example.migrations.boo.deployment;
|
|
};
|
|
expected = {
|
|
has-provider = true;
|
|
has-resource = true;
|
|
has-application = true;
|
|
has-deployment = true;
|
|
has-migration = true;
|
|
};
|
|
};
|
|
}
|