forked from Fediversity/Fediversity
WIP: add missing types
This commit is contained in:
parent
dd0aff13d7
commit
17647b194b
4 changed files with 63 additions and 2 deletions
|
@ -9,6 +9,8 @@ let
|
|||
git-hooks
|
||||
gitignore
|
||||
;
|
||||
inherit (import sources.flake-inputs) import-flake;
|
||||
inputs = (import-flake { src = ./.; }).inputs;
|
||||
inherit (pkgs) lib;
|
||||
inherit (import sources.flake-inputs) import-flake;
|
||||
inherit ((import-flake { src = ./.; }).inputs) nixops4;
|
||||
|
@ -78,6 +80,7 @@ in
|
|||
# re-export inputs so they can be overridden granularly
|
||||
# (they can't be accessed from the outside any other way)
|
||||
inherit
|
||||
inputs
|
||||
sources
|
||||
system
|
||||
pkgs
|
||||
|
|
|
@ -15,8 +15,6 @@ let
|
|||
}).config;
|
||||
in
|
||||
{
|
||||
_class = "nix-unit";
|
||||
|
||||
test-eval = {
|
||||
expr =
|
||||
let
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
|
@ -103,8 +104,18 @@ in
|
|||
};
|
||||
resource-mapping = mkOption {
|
||||
description = "Mapping of resources required by applications to available resources; the result can be deployed";
|
||||
type = environment.config.function.implementation;
|
||||
# TODO: type = consumer-resources /* same as the output of application.config-mapping, should be in a `let` */ -> nixops4Deployment
|
||||
};
|
||||
function = mkOption {
|
||||
description = "Function type for the mapping from resources to a (NixOps4) deployment";
|
||||
type = submodule functionType;
|
||||
readOnly = true;
|
||||
default = {
|
||||
input-type = application-resources;
|
||||
output-type = submodule nixops4Deployment;
|
||||
};
|
||||
};
|
||||
};
|
||||
})
|
||||
);
|
||||
|
|
49
deployment/interface.nix
Normal file
49
deployment/interface.nix
Normal file
|
@ -0,0 +1,49 @@
|
|||
/**
|
||||
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;
|
||||
};
|
||||
};
|
||||
});
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Reference in a new issue