allow different deployment types (#498)

Reviewed-on: Fediversity/Fediversity#498
This commit is contained in:
Kiara Grouwstra 2025-09-03 12:44:44 +02:00
parent 40e8a0a3c5
commit 4049ca8156
2 changed files with 11 additions and 6 deletions

View file

@ -13,7 +13,6 @@ let
./data-model.nix ./data-model.nix
]; ];
}).config; }).config;
nixops4Deployment = inputs.nixops4.modules.nixops4Deployment.default;
inherit (inputs.nixops4.lib) mkDeployment; inherit (inputs.nixops4.lib) mkDeployment;
in in
{ {
@ -32,7 +31,7 @@ in
expr = expr =
let let
fediversity = eval ( fediversity = eval (
{ config, ... }: { config, options, ... }:
{ {
config = { config = {
resources.login-shell = { resources.login-shell = {
@ -112,7 +111,7 @@ in
resources.operator-environment.login-shell.username = "operator"; resources.operator-environment.login-shell.username = "operator";
implementation = requests: { implementation = requests: {
input = requests; input = requests;
output = output.nixops4 =
{ providers, ... }: { providers, ... }:
{ {
providers = { providers = {
@ -145,7 +144,7 @@ in
}; };
}; };
example-deployment = mkOption { example-deployment = mkOption {
type = types.submodule nixops4Deployment; type = options.deployments.nestedType;
readOnly = true; readOnly = true;
default = config.environments.single-nixos-vm.deployment config.example-configuration; default = config.environments.single-nixos-vm.deployment config.example-configuration;
}; };

View file

@ -39,6 +39,12 @@ let
} }
]; ];
}; };
deployment = attrTag {
nixops4 = mkOption {
description = "A NixOps4 NixOS deployment. For an example, see https://github.com/nixops4/nixops4-nixos/blob/main/example/deployment.nix.";
type = nixops4Deployment;
};
};
in in
{ {
options = { options = {
@ -145,12 +151,12 @@ in
type = environment.config.resource-mapping.function-type; type = environment.config.resource-mapping.function-type;
}; };
resource-mapping = mkOption { resource-mapping = mkOption {
description = "Function type for the mapping from resources to a (NixOps4) deployment"; description = "Function type for the mapping from resources to a deployment";
type = submodule functionType; type = submodule functionType;
readOnly = true; readOnly = true;
default = { default = {
input-type = application-resources; input-type = application-resources;
output-type = nixops4Deployment; output-type = deployment;
}; };
}; };
# TODO(@fricklerhandwerk): maybe this should be a separate thing such as `fediversity-setup`, # TODO(@fricklerhandwerk): maybe this should be a separate thing such as `fediversity-setup`,