forked from Fediversity/Fediversity
85 lines
2.4 KiB
Nix
85 lines
2.4 KiB
Nix
{
|
|
lib,
|
|
...
|
|
}:
|
|
let
|
|
inherit (lib) types mkOption;
|
|
inherit (types)
|
|
attrTag
|
|
attrsOf
|
|
submodule
|
|
submoduleWith
|
|
deferredModule
|
|
;
|
|
in
|
|
{
|
|
options = {
|
|
runtime-environments = mkOption {
|
|
type = attrsOf (attrTag {
|
|
nixos = mkOption {
|
|
type = submodule {
|
|
options = {
|
|
module = mkOption {
|
|
description = "The NixOS module of the run-time environment";
|
|
type = deferredModule;
|
|
};
|
|
};
|
|
};
|
|
};
|
|
});
|
|
};
|
|
applications = mkOption {
|
|
description = "Collection of NixOS modules, each implementing a Fediversity application";
|
|
example.hello = {
|
|
enable = true;
|
|
module =
|
|
{ pkgs, ... }:
|
|
{
|
|
environment.systemPackages = [ pkgs.hello ];
|
|
};
|
|
};
|
|
type = attrsOf (submoduleWith {
|
|
description = "A Fediversity application";
|
|
modules = [
|
|
{
|
|
options = {
|
|
module = mkOption {
|
|
description = "The NixOS module to compose into an operator's configuration";
|
|
type = deferredModule;
|
|
};
|
|
components = mkOption {
|
|
type = attrsOf (attrTag {
|
|
file-system-state = mkOption {
|
|
desciption = "files stored by the application";
|
|
type = attrsOf (submodule {
|
|
options.minSize = types.bytes;
|
|
});
|
|
database-state = mkOption {
|
|
desciption = "state stored in databases by the application";
|
|
type = attrsOf (submodule {
|
|
postgresql = mkOption {
|
|
desciption = "state stored in PostgreSQL by the application";
|
|
type = attrsOf (submodule {
|
|
options = {
|
|
};
|
|
});
|
|
};
|
|
key-val = mkOption {
|
|
desciption = "state stored in a key-value store by the application";
|
|
type = attrsOf (submodule {
|
|
options = {
|
|
};
|
|
});
|
|
};
|
|
});
|
|
};
|
|
};
|
|
});
|
|
};
|
|
};
|
|
}
|
|
];
|
|
});
|
|
};
|
|
};
|
|
}
|