only accept eval/build for nix command

This commit is contained in:
Jörg Thalheim
2024-09-03 10:48:17 +02:00
parent 71705f8a51
commit 44813d2fcc

View File

@@ -140,7 +140,7 @@ class Machine:
def nix(
self,
method: str,
method: Literal["eval", "build"],
attr: str,
extra_config: None | dict = None,
impure: bool = False,
@@ -217,11 +217,7 @@ class Machine:
if method == "eval":
output = run_no_stdout(nix_eval(args)).stdout.strip()
return output
if method == "build":
outpath = run_no_stdout(nix_build(args)).stdout.strip()
return Path(outpath)
msg = f"Unknown method {method}"
raise ValueError(msg)
return Path(run_no_stdout(nix_build(args)).stdout.strip())
def eval_nix(
self,