forked from fediversity/fediversity
have run-time environments use their corresponding run-time configurations grant run-time environments their own modules with their own description data model: runtime environment allows declaring options so instantiations may configure required settings data model: deployment data model: migration better reflect naming from diagram configuration data flow WIP: implement data model as in diagram this doesn't update the tests yet because we don't have all the data types in place anyway yet, and I still need to come up with testable examples. WIP: add missing types WIP: start writing an evaluation test turns out we also need a collection of configurations, obviously next: figure out where to wire everything up to obtain a deployment WIP: implement mappings WIP: (broken) implement test WIP: illustrate an entire NixOS configuration as a resource fix typos, lint, format test for configuration passes, test for deployment wip use `mapAttrs` right `mapAttrs'` takes two args rather than a set, whereas if only the val changes `mapAttrs (_: v: ...)` should do rm deployment/resources
68 lines
1.6 KiB
Nix
68 lines
1.6 KiB
Nix
let
|
|
inherit (import ../default.nix { }) pkgs inputs;
|
|
inherit (pkgs) lib;
|
|
inherit (lib) mkOption;
|
|
eval =
|
|
module:
|
|
(lib.evalModules {
|
|
specialArgs = {
|
|
inherit inputs;
|
|
};
|
|
modules = [
|
|
module
|
|
./data-model.nix
|
|
];
|
|
}).config;
|
|
in
|
|
{
|
|
test-eval = {
|
|
expr =
|
|
let
|
|
fediversity = eval (
|
|
{ config, ... }:
|
|
{
|
|
config = {
|
|
applications.hello =
|
|
{ ... }:
|
|
{
|
|
description = ''Command-line tool that will print "Hello, world!" on the terminal'';
|
|
module =
|
|
{ ... }:
|
|
{
|
|
options = {
|
|
enable = lib.mkEnableOption "Hello in the shell";
|
|
};
|
|
};
|
|
implementation =
|
|
cfg:
|
|
lib.optionalAttrs cfg.enable {
|
|
dummy.login-shell.packages.hello = pkgs.hello;
|
|
};
|
|
};
|
|
};
|
|
options = {
|
|
example-configuration = mkOption {
|
|
type = config.configuration;
|
|
readOnly = true;
|
|
default = {
|
|
enable = true;
|
|
applications.hello.enable = true;
|
|
};
|
|
};
|
|
};
|
|
}
|
|
);
|
|
in
|
|
{
|
|
inherit (fediversity)
|
|
example-configuration
|
|
;
|
|
};
|
|
expected = {
|
|
example-configuration = {
|
|
enable = true;
|
|
applications.hello.enable = true;
|
|
};
|
|
};
|
|
};
|
|
}
|