Merge pull request 'clan-cli machines: get flake path via flake metadata' (#770) from lassulus-flake_dir into main

This commit is contained in:
clan-bot
2024-01-29 09:17:26 +00:00

View File

@@ -3,7 +3,7 @@ import logging
from pathlib import Path from pathlib import Path
from ..cmd import run from ..cmd import run
from ..nix import nix_build, nix_config, nix_eval from ..nix import nix_build, nix_config, nix_eval, nix_metadata
from ..ssh import Host, parse_deployment_address from ..ssh import Host, parse_deployment_address
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@@ -78,9 +78,7 @@ class Machine:
if hasattr(self, "flake_path"): if hasattr(self, "flake_path"):
return Path(self.flake_path) return Path(self.flake_path)
print(nix_eval([f"{self.flake}"])) self.flake_path = nix_metadata(self.flake)["path"]
print(f"self.flake:{self.flake}. Type: {type(self.flake)}")
self.flake_path = run(nix_eval([f"{self.flake} "])).stdout.strip()
return Path(self.flake_path) return Path(self.flake_path)
@property @property