diff --git a/tasks/validate-nur b/tasks/validate-nur new file mode 100755 index 0000000..64468cd --- /dev/null +++ b/tasks/validate-nur @@ -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