Inventory: fix options

This commit is contained in:
Johannes Kirschbauer
2024-07-17 10:55:46 +02:00
parent e236dba1c9
commit bc520df9ff
5 changed files with 10 additions and 10 deletions

View File

@@ -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"
}
}
},

View File

@@ -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"
];
})

View File

@@ -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 { };

View File

@@ -49,7 +49,7 @@ in
default = null;
type = types.nullOr types.str;
};
deploymentInfo = lib.mkOption {
deploy = lib.mkOption {
default = { };
type = types.submodule {
options = {

View File

@@ -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)
),
)