forked from clan/clan-core
clan-vm-manager: Fix regression
This commit is contained in:
parent
35e5ad513d
commit
0dcc9f903b
1
.envrc
1
.envrc
@ -4,6 +4,7 @@ if ! has nix_direnv_version || ! nix_direnv_version 3.0.4; then
|
||||
fi
|
||||
|
||||
watch_file .direnv/selected-shell
|
||||
watch_file formatter.nix
|
||||
|
||||
if [ -e .direnv/selected-shell ]; then
|
||||
use flake ".#$(cat .direnv/selected-shell)"
|
||||
|
@ -30,8 +30,8 @@
|
||||
{
|
||||
"pkgs/clan-vm-manager" = {
|
||||
extraPythonPackages =
|
||||
# clan-app currently only exists on linux
|
||||
self'.packages.clan-vm-manager.testDependencies ++ self'.packages.clan-cli.testDependencies;
|
||||
# # clan-app currently only exists on linux
|
||||
self'.packages.clan-vm-manager.testDependencies;
|
||||
modules = [ "clan_vm_manager" ];
|
||||
};
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ from ..vms.inspect import VmConfig, inspect_vm
|
||||
|
||||
@dataclass
|
||||
class FlakeConfig:
|
||||
flake_url: str | Path
|
||||
flake_url: FlakeId
|
||||
flake_attr: str
|
||||
|
||||
clan_name: str
|
||||
@ -89,7 +89,7 @@ def inspect_flake(flake_url: str | Path, machine_name: str) -> FlakeConfig:
|
||||
meta = nix_metadata(flake_url)
|
||||
return FlakeConfig(
|
||||
vm=vm,
|
||||
flake_url=flake_url,
|
||||
flake_url=FlakeId(flake_url),
|
||||
clan_name=clan_name,
|
||||
flake_attr=machine_name,
|
||||
nar_hash=meta["locked"]["narHash"],
|
||||
|
@ -62,7 +62,7 @@ def list_history() -> list[HistoryEntry]:
|
||||
|
||||
def new_history_entry(url: str, machine: str) -> HistoryEntry:
|
||||
flake = inspect_flake(url, machine)
|
||||
flake.flake_url = str(flake.flake_url)
|
||||
flake.flake_url = flake.flake_url
|
||||
return HistoryEntry(
|
||||
flake=flake,
|
||||
last_used=datetime.datetime.now().isoformat(),
|
||||
|
@ -16,7 +16,7 @@ def update_history() -> list[HistoryEntry]:
|
||||
|
||||
for entry in logs:
|
||||
try:
|
||||
meta = nix_metadata(entry.flake.flake_url)
|
||||
meta = nix_metadata(str(entry.flake.flake_url))
|
||||
except ClanCmdError as e:
|
||||
print(f"Failed to update {entry.flake.flake_url}: {e}")
|
||||
continue
|
||||
@ -31,7 +31,7 @@ def update_history() -> list[HistoryEntry]:
|
||||
machine_name=entry.flake.flake_attr,
|
||||
)
|
||||
flake = inspect_flake(uri.get_url(), uri.machine_name)
|
||||
flake.flake_url = str(flake.flake_url)
|
||||
flake.flake_url = flake.flake_url
|
||||
entry = HistoryEntry(
|
||||
flake=flake, last_used=datetime.datetime.now().isoformat()
|
||||
)
|
||||
|
@ -27,7 +27,7 @@ def test_history_add(
|
||||
history_file = user_history_file()
|
||||
assert history_file.exists()
|
||||
history = [HistoryEntry(**entry) for entry in json.loads(open(history_file).read())]
|
||||
assert history[0].flake.flake_url == str(test_flake_with_core.path)
|
||||
assert str(history[0].flake.flake_url["loc"]) == str(test_flake_with_core.path)
|
||||
|
||||
|
||||
@pytest.mark.impure
|
||||
|
@ -163,12 +163,12 @@ class ClanStore:
|
||||
del self.clan_store[str(vm.data.flake.flake_url)][vm.data.flake.flake_attr]
|
||||
|
||||
def get_vm(self, uri: ClanURI) -> None | VMObject:
|
||||
flake_id = Machine(uri.machine_name, uri.flake).get_id()
|
||||
vm_store = self.clan_store.get(flake_id)
|
||||
machine = Machine(uri.machine_name, uri.flake)
|
||||
vm_store = self.clan_store.get(str(machine.flake))
|
||||
if vm_store is None:
|
||||
return None
|
||||
machine = vm_store.get(uri.machine_name, None)
|
||||
return machine
|
||||
vm = vm_store.get(str(machine.name), None)
|
||||
return vm
|
||||
|
||||
def get_running_vms(self) -> list[VMObject]:
|
||||
return [
|
||||
|
@ -39,7 +39,7 @@ let
|
||||
libadwaita
|
||||
webkitgtk_6_0
|
||||
adwaita-icon-theme
|
||||
];
|
||||
] ++ clan-cli.propagatedBuildInputs;
|
||||
|
||||
# Deps including python packages from the local project
|
||||
allPythonDeps = [ (python3.pkgs.toPythonModule clan-cli) ] ++ externalPythonDeps;
|
||||
@ -84,7 +84,6 @@ python3.pkgs.buildPythonApplication rec {
|
||||
setuptools
|
||||
copyDesktopItems
|
||||
wrapGAppsHook
|
||||
|
||||
gobject-introspection
|
||||
];
|
||||
|
||||
@ -93,14 +92,7 @@ python3.pkgs.buildPythonApplication rec {
|
||||
# that all necessary dependencies are consistently available both
|
||||
# at build time and runtime,
|
||||
buildInputs = allPythonDeps ++ runtimeDependencies;
|
||||
propagatedBuildInputs =
|
||||
allPythonDeps
|
||||
++ runtimeDependencies
|
||||
++ [
|
||||
|
||||
# TODO: see postFixup clan-cli/default.nix:L188
|
||||
clan-cli.propagatedBuildInputs
|
||||
];
|
||||
propagatedBuildInputs = allPythonDeps ++ runtimeDependencies ++ [ ];
|
||||
|
||||
# also re-expose dependencies so we test them in CI
|
||||
passthru = {
|
||||
|
Loading…
Reference in New Issue
Block a user