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