forked from Fediversity/Fediversity
various failed attempts to type-check deployment application configurations using config-level applications
as a result of these failures, i instead opted to move applications from the config to the options layer, see branch `data-model-revamp`.
This commit is contained in:
parent
dbd3e90238
commit
fd3b71c8df
2 changed files with 48 additions and 6 deletions
|
@ -37,13 +37,20 @@ in
|
|||
applications.foo.module =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = [
|
||||
options.doll = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
};
|
||||
config.environment.systemPackages = [
|
||||
pkgs.hello
|
||||
];
|
||||
};
|
||||
deployments.baz = {
|
||||
module = { };
|
||||
inherit runtime-environment;
|
||||
application-configuration = {
|
||||
foo = {
|
||||
doll = 123;
|
||||
};
|
||||
};
|
||||
};
|
||||
migrations.boo = {
|
||||
inherit runtime-environment;
|
||||
|
@ -56,7 +63,7 @@ in
|
|||
has-provider = lib.isAttrs example.providers.ssh-host;
|
||||
has-resource = lib.isAttrs example.resources.bar.runtime-environment.ssh-host.module;
|
||||
has-application = lib.isAttrs example.applications.foo.module;
|
||||
has-deployment = lib.isAttrs example.deployments.baz.module;
|
||||
has-deployment = lib.isAttrs example.deployments.baz.application-configuration.foo.doll;
|
||||
has-migration = lib.isAttrs example.migrations.boo.deployment;
|
||||
};
|
||||
expected = {
|
||||
|
|
|
@ -120,12 +120,47 @@ let
|
|||
modules = [
|
||||
{
|
||||
options = {
|
||||
# the `applications` option consists of configuration for the above applications
|
||||
module = mkOption {
|
||||
application-configuration = mkOption {
|
||||
description = ''
|
||||
Configuration to be deployed
|
||||
'';
|
||||
type = deferredModule;
|
||||
# # error: attribute 'foo' missing
|
||||
# type = deferredModule;
|
||||
# type = submodule {
|
||||
# # # checks types but is hard-coded
|
||||
# # options = {
|
||||
# # foo = mkOption {
|
||||
# # # type = str;
|
||||
# # type = submodule {
|
||||
# # options = {
|
||||
# # doll = mkOption {
|
||||
# # type = str;
|
||||
# # };
|
||||
# # };
|
||||
# # };
|
||||
# # };
|
||||
# # };
|
||||
# # # `error: attribute 'doll' missing` in `example.deployments.baz.application-configuration.doll`
|
||||
# # freeformType = attrsOf deferredModule;
|
||||
# # options = mapAttrs
|
||||
# # (k: application: mkOption {
|
||||
# # description = "configuration options for ${k}";
|
||||
# # # # error: attribute 'doll' missing
|
||||
# # # type = deferredModule;
|
||||
# # # # XXX doesn't work as `import` is for paths
|
||||
# # # type = submodule { inherit (import application.module { }) options; };
|
||||
# # # # XXX doesn't work as `evalModules` is general, not recognizing nixos stuff like argument `pkgs` or `config.environment`
|
||||
# # # type = submodule {
|
||||
# # # inherit (lib.evalModules { modules = [ application.module ]; }) options;
|
||||
# # # };
|
||||
# # # # error: The option `deployments.baz.application-configuration.foo._module.freeformType' in `lib/modules.nix' is already declared in `data-model.nix'.
|
||||
# # # # n.b. `_module.freeformType` is an option set in `evalModules`.
|
||||
# # # type = submodule {
|
||||
# # # inherit (import "${sources.nixpkgs}/nixos" { configuration = application.module; }) options;
|
||||
# # # };
|
||||
# # })
|
||||
# # (removeAttrs (config.applications) [ "_module" ]);
|
||||
# };
|
||||
};
|
||||
runtime-environment = mkOption {
|
||||
description = "The run-time environment to deploy to";
|
||||
|
|
Loading…
Add table
Reference in a new issue