WIP: add missing types

This commit is contained in:
Valentin Gagarin 2025-07-01 22:07:42 +02:00 committed by Kiara Grouwstra
parent dd0aff13d7
commit 17647b194b
Signed by: kiara
SSH key fingerprint: SHA256:COspvLoLJ5WC5rFb9ZDe5urVCkK4LJZOsjfF4duRJFU
4 changed files with 63 additions and 2 deletions

View file

@ -9,6 +9,8 @@ let
git-hooks git-hooks
gitignore gitignore
; ;
inherit (import sources.flake-inputs) import-flake;
inputs = (import-flake { src = ./.; }).inputs;
inherit (pkgs) lib; inherit (pkgs) lib;
inherit (import sources.flake-inputs) import-flake; inherit (import sources.flake-inputs) import-flake;
inherit ((import-flake { src = ./.; }).inputs) nixops4; inherit ((import-flake { src = ./.; }).inputs) nixops4;
@ -78,6 +80,7 @@ in
# re-export inputs so they can be overridden granularly # re-export inputs so they can be overridden granularly
# (they can't be accessed from the outside any other way) # (they can't be accessed from the outside any other way)
inherit inherit
inputs
sources sources
system system
pkgs pkgs

View file

@ -15,8 +15,6 @@ let
}).config; }).config;
in in
{ {
_class = "nix-unit";
test-eval = { test-eval = {
expr = expr =
let let

View file

@ -1,6 +1,7 @@
{ {
lib, lib,
config, config,
inputs,
... ...
}: }:
let let
@ -103,8 +104,18 @@ in
}; };
resource-mapping = mkOption { resource-mapping = mkOption {
description = "Mapping of resources required by applications to available resources; the result can be deployed"; 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 # 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
View 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;
};
};
});
};
};
}