add output diffs

Signed-off-by: ahuston-0 <aliceghuston@gmail.com>
This commit is contained in:
2024-07-04 00:33:54 -04:00
committed by Alice Huston
parent 6d41203f89
commit 042732b15d
4 changed files with 77 additions and 0 deletions

24
utils/diff-evals.sh Normal file
View File

@ -0,0 +1,24 @@
#!/usr/bin/env nix
#! nix shell nixpkgs#bash nixpkgs#gnugrep nixpkgs#nvd --command bash
# diffs each derivation
set -x
set -v
set -e
script_path=$(dirname "$(readlink -f $0)")
parent_path=$(dirname "$script_path")
readarray -t pre_drv < "$parent_path/pre-drv"
readarray -t post_drv < "$parent_path/post-drv"
post_drv_path="$parent_path/post-diff"
# cleanup any files with the same name
rm "$post_drv_path" || true
touch "$post_drv_path"
for i in $(seq 0 $(( "${#pre_drv[@]}" -1 ))); do
echo "Diffing updates to $(echo "${pre_drv[$i]}" | cut -f 2- -d '-')" >> "$post_drv_path"
nvd diff "${pre_drv[$i]}" "${post_drv[$i]}" >> "$post_drv_path"
done

21
utils/eval-to-drv.sh Normal file
View File

@ -0,0 +1,21 @@
#!/usr/bin/env nix
#! nix shell nixpkgs#bash nixpkgs#gnugrep --command bash
# diffs each derivation
set -x
set -v
set -e
if [ "$#" -ne 2 ]; then
echo "$0 (pre|post)"
fi
script_path=$(dirname "$(readlink -f $0)")
parent_path=$(dirname "$script_path")
out_path="$parent_path/$1-drv"
drv=$(nix flake check --verbose 2> >(grep -P -o "derivation evaluated to (/nix/store/.*\.drv)" | grep -P -o "/nix/store/.*\.drv"))
echo "$drv" > "$out_path"