Fediversity/deployment/interface.nix

49 lines
1.1 KiB
Nix

/**
Modular function type
*/
{ config, ... }:
{
options = {
input-type = mkOption {
type = deferredModule;
};
output-type = mkOption {
type = deferredModule;
};
implementation = mkOption {
type = optionType;
readOnly = true;
default = implementationTo (
submodule (implementation: {
options = {
input = mkOption {
type = submodule config.input-type;
};
output = mkOption {
type = submodule config.output-type;
};
};
})
);
};
apply = mkOption {
type = optionType;
readOnly = true;
default = submodule (apply: {
options = {
implementation = mkOption {
type = config.implementation;
};
input = mkOption {
type = submodule config.input-type;
};
output = mkOption {
type = submodule config.output-type;
readOnly = true;
default = (apply.config.implementation apply.config.input).output;
};
};
});
};
};
}