allow IFD in nix flake show
Signed-off-by: ahuston-0 <aliceghuston@gmail.com>
This commit is contained in:
@ -71,7 +71,7 @@ def get_derivations_from_check(nix_path: str, path_to_flake: str) -> list[str]:
|
||||
return derivations
|
||||
|
||||
|
||||
def get_derivations(path_to_flake: str) -> 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 +83,9 @@ def get_derivations(path_to_flake: str) -> list[str]:
|
||||
if nix_path is None:
|
||||
status_msg = "nix is not available in the PATH, please verify that it is installed"
|
||||
raise RuntimeError(status_msg)
|
||||
flake_show = bash_wrapper(f"{nix_path} flake show --json --accept-flake-path", path=path_to_flake)
|
||||
cmd = f"{nix_path} flake show --json --accept-flake-path"
|
||||
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:
|
||||
logger.error("flake show returned non-zero exit code")
|
||||
logger.warning("falling back to full evaluation via nix flake check")
|
||||
|
Reference in New Issue
Block a user