Add NUR export validation script

This commit is contained in:
Andrew Kvalheim 2024-05-14 15:31:47 -07:00
parent 5e48ab41b2
commit f050831191

23
tasks/validate-nur Executable file
View file

@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -Eeuo pipefail
for channel in 'unstable' 'nixpkgs'; do
nix_args=(
--option restrict-eval 'true'
-I './'
-I "$channel=$(realpath "$(nix-instantiate --find-file "$channel")")"
--arg 'pkgs' "import <$channel> { overlays = [ ]; }"
)
nix-env "${nix_args[@]}" --file 'nur.nix' --query '*' --available --meta --json \
| jq --raw-output 'to_entries[] | "\(.key)\(.value.meta.broken)"' \
| while IFS='' read -r name broken; do
if [[ $broken == 'true' ]]; then
echo "⚠️ Build marked as broken for $name@$channel"
elif nix-build "${nix_args[@]}" 'nur.nix' --attr "$name" --no-out-link; then
echo "✅ Build succeeded for $name@$channel"
else
echo "❌️ Build failed for $name@$channel"
fi
done
done