WIP: sketch domain data model

This commit is contained in:
Valentin Gagarin 2025-06-10 15:45:14 +02:00
parent 69b2e535fe
commit ef345a7fcb
2 changed files with 91 additions and 0 deletions

View file

@ -0,0 +1,50 @@
{
lib,
...
}:
let
inherit (lib) types mkOption;
in
{
options = {
enable = lib.mkEnableOption "Fediversity configuration";
applications = mkOption {
description = "Collection of NixOS modules, each implementing a Fediversity application";
example.hello = {
enable = true;
module = {pkgs, ...}: {
environment.systemPackages = [ pkgs.hello ];
};
};
type = with types; attrsOf (submoduleWith {
class = "nixos";
description = "A Fediversity application";
modules = [
(application: {
options = {
enable = mkOption {
type = types.bool;
};
module = mkOption {
default = "The NixOS module to compose into an operator's configuration"
type = types.deferredModule;
};
components = mkOption {
type = with types; attrsOf (attrTag {
file-system-state = mkOption {
desciption = "files stored by the application";
type = with types; attrsOf (submodule {
options.minSize = types.bytes;
});
example = {
"/foo/bar/baz" = { minSize = 1024; };
};
};
});
};
};
})
];
});
};
}

View file

@ -0,0 +1,41 @@
{
lib,
...
}:
let
inherit (lib) types mkOption;
in
{
options = {
infrastructure = mkOption {
description = "Infrastructure for Fediversity applications to run on";
type =
with types;
attrsOf (attrTag {
single-nixos-machine-via-usb = mkOption {
type =
with types;
submodule {
# TODO: maybe steal some data structures from NixOS
options = {
hasNetwork = mkOption {
type = types.bool;
};
disks = mkOption {
type =
with types;
attrsOf (submodule {
options.size = mkOption {
type = types.bytes;
};
});
};
};
};
};
});
};
};
}