forked from clan/clan-core
history: added vm config to FlakeConfig
This commit is contained in:
parent
9649e43da5
commit
e0bba046ea
@ -8,6 +8,7 @@ from ..dirs import specific_groot_dir
|
||||
from ..errors import ClanError
|
||||
from ..machines.list import list_machines
|
||||
from ..nix import nix_build, nix_config, nix_eval, nix_metadata
|
||||
from ..vms.inspect import VmConfig, inspect_vm
|
||||
|
||||
|
||||
@dataclass
|
||||
@ -21,6 +22,7 @@ class FlakeConfig:
|
||||
description: str | None
|
||||
last_updated: str
|
||||
revision: str | None
|
||||
vm: VmConfig
|
||||
|
||||
|
||||
def run_cmd(cmd: list[str]) -> str:
|
||||
@ -50,6 +52,8 @@ def inspect_flake(flake_url: str | Path, flake_attr: str) -> FlakeConfig:
|
||||
f"Machine {flake_attr} not found in {flake_url}. Available machines: {', '.join(machines)}"
|
||||
)
|
||||
|
||||
vm = inspect_vm(flake_url, flake_attr)
|
||||
|
||||
# Get the cLAN name
|
||||
cmd = nix_eval(
|
||||
[
|
||||
@ -86,6 +90,7 @@ def inspect_flake(flake_url: str | Path, flake_attr: str) -> FlakeConfig:
|
||||
meta = nix_metadata(flake_url)
|
||||
|
||||
return FlakeConfig(
|
||||
vm=vm,
|
||||
flake_url=flake_url,
|
||||
clan_name=clan_name,
|
||||
flake_attr=flake_attr,
|
||||
|
@ -46,6 +46,7 @@ def list_history() -> list[HistoryEntry]:
|
||||
return logs
|
||||
|
||||
|
||||
# TODO: Add all vm entries to history
|
||||
def add_history(uri: ClanURI) -> list[HistoryEntry]:
|
||||
uri.check_exits()
|
||||
user_history_file().parent.mkdir(parents=True, exist_ok=True)
|
||||
|
@ -75,6 +75,7 @@ class Trust(Gtk.Box):
|
||||
self.set_center_widget(layout)
|
||||
|
||||
def on_trust(self, widget: Gtk.Widget) -> None:
|
||||
# TODO: @Johannes, replace image with real clan logo
|
||||
try:
|
||||
uri = self.url or ClanURI(self.entry.get_text())
|
||||
print(f"trusted: {uri}")
|
||||
|
Loading…
Reference in New Issue
Block a user