update flake lock, add flake diff, add evaluation json
Signed-off-by: ahuston-0 <aliceghuston@gmail.com>
This commit is contained in:
30
flupdt/flake_diff.py
Normal file
30
flupdt/flake_diff.py
Normal file
@ -0,0 +1,30 @@
|
||||
"""Utility to diff nix derivations."""
|
||||
|
||||
import logging
|
||||
import shutil
|
||||
|
||||
from flupdt.common import bash_wrapper
|
||||
|
||||
|
||||
def compare_derivations(
|
||||
path_to_flake: str, path_to_pre_drv: str, path_to_post_drv: str
|
||||
) -> list[str]:
|
||||
"""Gets all derivations present in a flake.
|
||||
|
||||
:param path_to_flake: path to flake to be checked
|
||||
:returns a list of all valid derivations in the flake
|
||||
:raises RuntimeError: fails if nix is not present in the PATH
|
||||
"""
|
||||
nvd_path = shutil.which("nvd")
|
||||
if nvd_path is None:
|
||||
status_msg = "nvd is not available in the PATH, please verify that it is installed"
|
||||
raise RuntimeError(status_msg)
|
||||
diff_output = bash_wrapper(
|
||||
f"{nvd_path} diff {path_to_pre_drv} {path_to_post_drv}", path=path_to_flake
|
||||
)
|
||||
|
||||
logging.debug(diff_output[0])
|
||||
logging.debug(diff_output[1])
|
||||
logging.debug(diff_output[2])
|
||||
|
||||
return diff_output
|
Reference in New Issue
Block a user