revert submodule wrapper to align with module functions already doing types #2

Closed
kiara wants to merge 37 commits from kiara/Fediversity:fix-submodule-type into main
2 changed files with 29 additions and 21 deletions
Showing only changes of commit 243ef4425b - Show all commits

View file

@ -82,9 +82,9 @@ in
type = types.bool; type = types.bool;
default = false; default = false;
}; };
apply = mkOption { };
type = with types; functionTo raw; # TODO: splice out the user type from NixOS config.resource-type = types.any; # TODO: splice out the user type from NixOS
default = config.apply =
requests: requests:
let let
# Filter out requests that need wheel if policy doesn't allow it # Filter out requests that need wheel if policy doesn't allow it
@ -99,8 +99,6 @@ in
}; };
}; };
}; };
};
};
applications.hello = applications.hello =
{ ... }: { ... }:
{ {
@ -164,8 +162,7 @@ in
{ {
inherit (fediversity) example-deployment; inherit (fediversity) example-deployment;
}; };
expected = expected = {
{
}; };
}; };
} }

View file

@ -53,12 +53,23 @@ in
description = "Options for configuring the resource policy for the hosting provider, a description of how the resource is made available"; description = "Options for configuring the resource policy for the hosting provider, a description of how the resource is made available";
type = deferredModuleWith { type = deferredModuleWith {
staticModules = [ staticModules = [
{ (policy: {
_class = "fediversity-resource-policy"; _class = "fediversity-resource-policy";
# TODO(@fricklerhandwerk): not sure it can be made
# sensible syntactically, but essentially we want to
# ensure that `apply` is defined, but since its output
# depends on the specific policy we also need to
# determine that somehow.
# hopefully this also helps with correct composition down the line.
options.resource-type = mkOption {
description = "The type of resource this policy configures";
type = types.optionType;
};
options.apply = mkOption { options.apply = mkOption {
description = "Apply the policy to a request"; description = "Apply the policy to a request";
type = with types; functionTo policy.config.resource-type;
}; };
} })
]; ];
}; };
}; };