use nix-diff to diff between two evals
This commit is contained in:
parent
65c819b1ba
commit
bdf4d90bf8
3 changed files with 19 additions and 28 deletions
32
.github/workflows/update.yml
vendored
32
.github/workflows/update.yml
vendored
|
@ -19,33 +19,19 @@ jobs:
|
|||
# instantiate the current derivations
|
||||
- id: update-step
|
||||
run: |
|
||||
for job in nixos-8gb-fsn1-1 nutty-noon thinkrac installer nas; do
|
||||
nix show-derivation -r ".#hydraJobs.$job.x86_64-linux" > old-$job.json
|
||||
done
|
||||
|
||||
nix flake update
|
||||
|
||||
echo "Difference between this PR and main:" > report
|
||||
echo "" >> report
|
||||
for job in nixos-8gb-fsn1-1 nutty-noon thinkrac installer nas; do
|
||||
nix show-derivation -r ".#hydraJobs.$job.x86_64-linux" > new-$job.json
|
||||
|
||||
python scripts/diff-drvs.py old-$job.json new-$job.json > report-$job.txt
|
||||
cat report-$job.txt >> full-report.txt
|
||||
old_job=$(nix build --dry-run "github:DarkKirb/nixos-config/main#$hydraJobs.$job.x86_64-linux" 2>&1 | tail -n1)
|
||||
new_job=$(nix build --dry-run ".#$hydraJobs.$job.x86_64-linux" 2>&1 | tail -n1)
|
||||
echo "<details>" >> report
|
||||
echo "<summary>expression difference for $job</summary>" >> report
|
||||
nix run 'nixpkgs#nix-diff' $old_job $new_job >> report
|
||||
echo "</details>" >> report
|
||||
done
|
||||
|
||||
if [ -s full-report.txt ]; then
|
||||
echo "Automatic flake.lock update" > pr-message.txt
|
||||
echo "" >> pr-message.txt
|
||||
for job in nixos-8gb-fsn1-1 nutty-noon thinkrac installer nas; do
|
||||
echo "## Changes for $job:" >> pr-message.txt
|
||||
echo '```' >> pr-message.txt
|
||||
cat report-$job.txt >> pr-message.txt
|
||||
echo '```' >> pr-message.txt
|
||||
done
|
||||
else
|
||||
touch pr-message.txt
|
||||
fi
|
||||
|
||||
body=$(cat pr-message.txt)
|
||||
body=$(cat report.txt)
|
||||
body="${body//'%'/'%25'}"
|
||||
body="${body//$'\n'/'%0A'}"
|
||||
body="${body//$'\r'/'%0D'}"
|
||||
|
|
|
@ -95,6 +95,7 @@ rec {
|
|||
jq
|
||||
bundix
|
||||
python3
|
||||
python3Packages.yapf
|
||||
];
|
||||
};
|
||||
hydraJobs = (builtins.listToAttrs (map
|
||||
|
|
|
@ -17,7 +17,8 @@ packages = {}
|
|||
for drv in old_derivation:
|
||||
drvData = old_derivation[drv]
|
||||
if "pname" in drvData["env"]:
|
||||
version = drvData["env"]["version"] if "version" in drvData["env"] else drv
|
||||
version = drvData["env"]["version"] if "version" in drvData[
|
||||
"env"] else drv
|
||||
if drvData["env"]["pname"] in packages:
|
||||
packages[drvData["env"]["pname"]]["old"].add(version)
|
||||
else:
|
||||
|
@ -26,7 +27,8 @@ for drv in old_derivation:
|
|||
for drv in new_derivation:
|
||||
drvData = new_derivation[drv]
|
||||
if "pname" in drvData["env"]:
|
||||
version = drvData["env"]["version"] if "version" in drvData["env"] else drv
|
||||
version = drvData["env"]["version"] if "version" in drvData[
|
||||
"env"] else drv
|
||||
if drvData["env"]["pname"] in packages:
|
||||
if "new" in packages[drvData["env"]["pname"]]:
|
||||
packages[drvData["env"]["pname"]]["new"].add(version)
|
||||
|
@ -38,7 +40,9 @@ for drv in new_derivation:
|
|||
for package in packages:
|
||||
if "old" in packages[package] and "new" in packages[package]:
|
||||
if packages[package]["old"] != packages[package]["new"]:
|
||||
print(f"{package}: {packages[package]['old']} -> {packages[package]['new']}")
|
||||
print(
|
||||
f"{package}: {packages[package]['old']} -> {packages[package]['new']}"
|
||||
)
|
||||
elif "old" in packages[package]:
|
||||
print(f"{package}: {packages[package]['old']} -> removed")
|
||||
elif "new" in packages[package]:
|
||||
|
|
Loading…
Reference in a new issue