forked from Fediversity/Fediversity
68 lines
1.7 KiB
Nix
68 lines
1.7 KiB
Nix
{
|
|
lib,
|
|
config,
|
|
...
|
|
}:
|
|
let
|
|
inherit (lib) attrNames mkOption genAttrs;
|
|
inherit (lib.types)
|
|
attrsOf
|
|
attrTag
|
|
deferredModule
|
|
submoduleWith
|
|
;
|
|
runtime-configuration = mkOption {
|
|
description = "The NixOS module of a run-time environment";
|
|
type = deferredModule;
|
|
default = {
|
|
_class = "nixos";
|
|
};
|
|
};
|
|
runtime-environment = attrTag {
|
|
nixos = mkOption {
|
|
type = submoduleWith {
|
|
modules = [
|
|
{
|
|
options = {
|
|
module = mkOption {
|
|
description = "The NixOS module of the run-time environment";
|
|
type = deferredModule;
|
|
default = config.runtime-configurations.nixos;
|
|
readOnly = true;
|
|
};
|
|
};
|
|
}
|
|
];
|
|
};
|
|
};
|
|
};
|
|
application = submoduleWith {
|
|
description = "A Fediversity application";
|
|
modules = [
|
|
{
|
|
options = {
|
|
module = mkOption {
|
|
description = "The NixOS module for that application, for configuring that application";
|
|
type = deferredModule;
|
|
};
|
|
};
|
|
}
|
|
];
|
|
};
|
|
in
|
|
{
|
|
options = {
|
|
runtime-configurations = mkOption {
|
|
description = "Collection of runtime environments into which applications can be deployed";
|
|
type = attrTag (genAttrs (attrNames runtime-environment.nestedTypes) (_: runtime-configuration));
|
|
};
|
|
runtime-environments = mkOption {
|
|
description = "Collection of runtime environments into which applications can be deployed";
|
|
type = attrsOf runtime-environment;
|
|
};
|
|
applications = mkOption {
|
|
description = "Collection of Fediversity applications";
|
|
type = attrsOf application;
|
|
};
|
|
};
|
|
}
|