forked from fediversity/fediversity
Compare commits
No commits in common. "89b22df3a46b9c5c041b780ca0eceb942e5a6b96" and "bf488f89e120242dcf0509bbf51eef6219067a58" have entirely different histories.
89b22df3a4
...
bf488f89e1
3 changed files with 16 additions and 34 deletions
|
@ -106,17 +106,16 @@ in
|
|||
module =
|
||||
{ ... }:
|
||||
{
|
||||
options.enable = lib.mkEnableOption "Hello in the shell";
|
||||
enable = lib.mkEnableOption "Hello in the shell";
|
||||
};
|
||||
implementation = cfg: {
|
||||
input = cfg;
|
||||
output = lib.optionalAttrs cfg.enable {
|
||||
resources.hello.login-shell.packages = {
|
||||
implementation =
|
||||
cfg:
|
||||
lib.optionalAttrs cfg.enable {
|
||||
hello.login-shell.packages = {
|
||||
inherit (pkgs) hello;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
environments.single-nixos-vm =
|
||||
{ config, ... }:
|
||||
{
|
||||
|
@ -162,15 +161,10 @@ in
|
|||
}
|
||||
);
|
||||
in
|
||||
rec {
|
||||
config = fediversity.example-configuration;
|
||||
resources = fediversity.applications.hello.implementation config.applications.hello;
|
||||
{
|
||||
inherit (fediversity) example-deployment;
|
||||
};
|
||||
expected = {
|
||||
config = {
|
||||
enable = true;
|
||||
applications.hello.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -17,28 +17,15 @@ let
|
|||
;
|
||||
|
||||
functionType = import ./function.nix;
|
||||
application-resources = submodule {
|
||||
application-resources = {
|
||||
options.resources = mkOption {
|
||||
# TODO: maybe transpose, and group the resources by type instead
|
||||
type = attrsOf (
|
||||
attrTag (
|
||||
lib.mapAttrs (_name: resource: mkOption { type = submodule resource.request; }) config.resources
|
||||
)
|
||||
attrTag (lib.mapAttrs (_name: resource: mkOption { type = resource.request; }) config.resources)
|
||||
);
|
||||
};
|
||||
};
|
||||
nixops4Deployment = types.deferredModuleWith {
|
||||
staticModules = [
|
||||
inputs.nixops4.modules.nixops4Deployment.default
|
||||
|
||||
{
|
||||
_module.args = {
|
||||
resourceProviderSystem = builtins.currentSystem;
|
||||
resources = { };
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
nixops4Deployment = inputs.nixops4.modules.nixops4Deployment.default;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
|
@ -116,7 +103,7 @@ in
|
|||
type = submodule functionType;
|
||||
readOnly = true;
|
||||
default = {
|
||||
input-type = submodule application.config.module;
|
||||
input-type = application.config.module;
|
||||
output-type = application-resources;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
let
|
||||
inherit (lib) mkOption types;
|
||||
inherit (types)
|
||||
deferredModule
|
||||
submodule
|
||||
functionTo
|
||||
optionType
|
||||
|
@ -13,10 +14,10 @@ in
|
|||
{
|
||||
options = {
|
||||
input-type = mkOption {
|
||||
type = optionType;
|
||||
type = deferredModule;
|
||||
};
|
||||
output-type = mkOption {
|
||||
type = optionType;
|
||||
type = deferredModule;
|
||||
};
|
||||
function-type = mkOption {
|
||||
type = optionType;
|
||||
|
@ -25,10 +26,10 @@ in
|
|||
submodule (function: {
|
||||
options = {
|
||||
input = mkOption {
|
||||
type = config.input-type;
|
||||
type = submodule config.input-type;
|
||||
};
|
||||
output = mkOption {
|
||||
type = config.output-type;
|
||||
type = submodule config.output-type;
|
||||
};
|
||||
};
|
||||
})
|
||||
|
|
Loading…
Add table
Reference in a new issue