Inventory: fix options
This commit is contained in:
@@ -11,8 +11,8 @@
|
||||
"icon": "./path/to/icon.png",
|
||||
"tags": ["1", "2", "3"],
|
||||
"system": "x86_64-linux",
|
||||
"deployment_info": {
|
||||
"target_host": "root@remote.com"
|
||||
"deploy": {
|
||||
"targetHost": "root@remote.com"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -89,7 +89,7 @@ let
|
||||
];
|
||||
inventoryPath = [ "system" ];
|
||||
})
|
||||
# deploymentInfo.targetHost
|
||||
# deploy.targetHost
|
||||
// (clanToInventory config {
|
||||
clanPath = [
|
||||
"clan"
|
||||
@@ -98,7 +98,7 @@ let
|
||||
"targetHost"
|
||||
];
|
||||
inventoryPath = [
|
||||
"deploymentInfo"
|
||||
"deploy"
|
||||
"targetHost"
|
||||
];
|
||||
})
|
||||
|
||||
@@ -148,8 +148,8 @@ let
|
||||
(lib.optionalAttrs (machineConfig.system or null != null) {
|
||||
config.nixpkgs.hostPlatform = machineConfig.system;
|
||||
})
|
||||
(lib.optionalAttrs (machineConfig.deploymentInfo.targetHost or null != null) {
|
||||
config.clan.core.networking.targetHost = machineConfig.deploymentInfo.targetHost;
|
||||
(lib.optionalAttrs (machineConfig.deploy.targetHost or null != null) {
|
||||
config.clan.core.networking.targetHost = machineConfig.deploy.targetHost;
|
||||
})
|
||||
]
|
||||
) inventory.machines or { };
|
||||
|
||||
@@ -49,7 +49,7 @@ in
|
||||
default = null;
|
||||
type = types.nullOr types.str;
|
||||
};
|
||||
deploymentInfo = lib.mkOption {
|
||||
deploy = lib.mkOption {
|
||||
default = { };
|
||||
type = types.submodule {
|
||||
options = {
|
||||
|
||||
@@ -63,7 +63,7 @@ class Machine:
|
||||
tags: list[str] = field(default_factory=list)
|
||||
system: Literal["x86_64-linux"] | str | None = None
|
||||
|
||||
deployment_info: DeploymentInfo | None = None
|
||||
deploy: DeploymentInfo | None = None
|
||||
|
||||
@staticmethod
|
||||
def from_dict(d: dict[str, Any]) -> "Machine":
|
||||
@@ -73,8 +73,8 @@ class Machine:
|
||||
icon=d.get("icon", None),
|
||||
tags=d.get("tags", []),
|
||||
system=d.get("system", None),
|
||||
deployment_info=DeploymentInfo(
|
||||
target_host=d.get("deploymentInfo", {}).get("targetHost", None)
|
||||
deploy=DeploymentInfo(
|
||||
target_host=d.get("deploy", {}).get("targetHost", None)
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user