forked from Fediversity/Fediversity
revert submodule
wrapper to align with module functions already doing types #2
2 changed files with 56 additions and 6 deletions
|
@ -17,12 +17,20 @@ in
|
||||||
expr =
|
expr =
|
||||||
let
|
let
|
||||||
example = eval {
|
example = eval {
|
||||||
runtime-configurations.nixos =
|
runtime-configurations.single-ssh-host =
|
||||||
{ ... }:
|
{ ... }:
|
||||||
{
|
{
|
||||||
system.stateVersion = "25.05";
|
system.stateVersion = "25.05";
|
||||||
};
|
};
|
||||||
runtime-environments.bar.nixos = { };
|
runtime-environments.bar = {
|
||||||
|
single-ssh-host = {
|
||||||
|
ssh = {
|
||||||
|
host = "localhost";
|
||||||
|
username = "root";
|
||||||
|
authentication.password = "";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
applications.foo = {
|
applications.foo = {
|
||||||
module =
|
module =
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
|
@ -35,8 +43,8 @@ in
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
has-runtime-configuration = lib.isAttrs example.runtime-configurations.nixos;
|
has-runtime-configuration = lib.isAttrs example.runtime-configurations.single-ssh-host;
|
||||||
has-runtime-environment = lib.isAttrs example.runtime-environments.bar.nixos.module;
|
has-runtime-environment = lib.isAttrs example.runtime-environments.bar.single-ssh-host.module;
|
||||||
has-application = lib.isAttrs example.applications.foo.module;
|
has-application = lib.isAttrs example.applications.foo.module;
|
||||||
};
|
};
|
||||||
expected = {
|
expected = {
|
||||||
|
|
|
@ -15,8 +15,10 @@ let
|
||||||
attrTag
|
attrTag
|
||||||
deferredModule
|
deferredModule
|
||||||
mergeTypes
|
mergeTypes
|
||||||
|
nullOr
|
||||||
submoduleWith
|
submoduleWith
|
||||||
submodule
|
submodule
|
||||||
|
str
|
||||||
;
|
;
|
||||||
runtime-configuration = mkOption {
|
runtime-configuration = mkOption {
|
||||||
description = "The NixOS module of a run-time environment";
|
description = "The NixOS module of a run-time environment";
|
||||||
|
@ -45,9 +47,49 @@ let
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
nixos = {
|
vm = {
|
||||||
description = "A NixOS instance to deploy to.";
|
description = "A VM to deploy to.";
|
||||||
type = submodule {
|
type = submodule {
|
||||||
|
options = {
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
single-ssh-host = {
|
||||||
|
description = "A single host to deploy to by SSH.";
|
||||||
|
type = submodule {
|
||||||
|
options = {
|
||||||
|
ssh = mkOption {
|
||||||
|
description = "SSH connection info";
|
||||||
|
type = submodule {
|
||||||
|
options = {
|
||||||
|
host = mkOption {
|
||||||
|
description = "the host to access by SSH";
|
||||||
|
type = str;
|
||||||
|
};
|
||||||
|
username = mkOption {
|
||||||
|
description = "the SSH user to use";
|
||||||
|
type = nullOr str;
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
authentication = mkOption {
|
||||||
|
description = "authentication method";
|
||||||
|
type = attrsOf (attrTag {
|
||||||
|
private-key = mkOption {
|
||||||
|
description = "path to the user's SSH private key";
|
||||||
|
type = str;
|
||||||
|
example = "/root/.ssh/id_ed25519";
|
||||||
|
};
|
||||||
|
password = mkOption {
|
||||||
|
description = "SSH password";
|
||||||
|
# TODO: mark as sensitive
|
||||||
|
type = str;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue