fix flake show
This commit is contained in:
parent
2cc162404b
commit
a8dad4af5b
@ -23,7 +23,9 @@ def build_output(path: str, output: str) -> str | None:
|
||||
"""
|
||||
logger.info(f"build {output}")
|
||||
logger.debug(f"outputting to {OUTPUT_DIR}/{output}.nixoutput")
|
||||
out = bash_wrapper(f"nix build {path}#{output} -o {OUTPUT_DIR}/{output}.nixoutput --accept-flake-config")
|
||||
out = bash_wrapper(
|
||||
f"nix build {path}#{output} -o {OUTPUT_DIR}/{output}.nixoutput --accept-flake-config"
|
||||
)
|
||||
logger.debug("output")
|
||||
logger.debug(out[0])
|
||||
logger.debug("error")
|
||||
|
@ -53,7 +53,9 @@ def get_derivations_from_check(nix_path: str, path_to_flake: str) -> list[str]:
|
||||
:param path_to_flake: path to flake to be checked
|
||||
:returns a list of all valid derivations in the flake
|
||||
"""
|
||||
flake_check = bash_wrapper(f"{nix_path} flake check --verbose --keep-going --accept-flake-config", path=path_to_flake)
|
||||
flake_check = bash_wrapper(
|
||||
f"{nix_path} flake check --verbose --keep-going --accept-flake-config", path=path_to_flake
|
||||
)
|
||||
if flake_check[2] != 0:
|
||||
logger.warning(
|
||||
"nix flake check returned non-zero exit code, collecting all available outputs"
|
||||
@ -71,7 +73,9 @@ def get_derivations_from_check(nix_path: str, path_to_flake: str) -> list[str]:
|
||||
return derivations
|
||||
|
||||
|
||||
def get_derivations(path_to_flake: str, *, allow_import_from_derivation: False = False) -> list[str]:
|
||||
def get_derivations(
|
||||
path_to_flake: str, *, allow_import_from_derivation: False = False
|
||||
) -> list[str]:
|
||||
"""Gets all derivations present in a flake.
|
||||
|
||||
:param path_to_flake: path to flake to be checked
|
||||
@ -83,7 +87,7 @@ def get_derivations(path_to_flake: str, *, allow_import_from_derivation: False =
|
||||
if nix_path is None:
|
||||
status_msg = "nix is not available in the PATH, please verify that it is installed"
|
||||
raise RuntimeError(status_msg)
|
||||
cmd = f"{nix_path} flake show --json --accept-flake-path"
|
||||
cmd = f"{nix_path} flake show --json --accept-flake-config --all-systems"
|
||||
cmd += " --allow-import-from-derivation" if allow_import_from_derivation else ""
|
||||
flake_show = bash_wrapper(cmd, path=path_to_flake)
|
||||
if flake_show[2] != 0:
|
||||
|
@ -99,7 +99,8 @@ def build_or_eval(args: Namespace) -> None:
|
||||
"""
|
||||
flake_path = args.flake_path
|
||||
derivations, hydra_jobs = partition(
|
||||
lambda s: s.startswith("hydraJobs"), get_derivations(flake_path, args["allow-import-from-derivation"])
|
||||
lambda s: s.startswith("hydraJobs"),
|
||||
get_derivations(flake_path, allow_import_from_derivation=args.allow_import_from_derivation),
|
||||
)
|
||||
derivations, hydra_jobs = list(derivations), list(hydra_jobs)
|
||||
logger.info(f"derivations: {list(derivations)}")
|
||||
|
Loading…
x
Reference in New Issue
Block a user