executable_mjru-flake 627 B

1234567891011121314151617181920
  1. #!/usr/bin/env bash
  2. mapfile -t files < <(find ./ -maxdepth 3 -type f -name flake.nix -print)
  3. flakes()
  4. {
  5. for file in "${files[@]}"
  6. do
  7. group="$(dirname "$(dirname "$file")")"
  8. group="${group//./-}"
  9. group="${group/_/}"
  10. name="$(basename "$(dirname "$file")")"
  11. name="${name//./-}"
  12. name="${name/_/}"
  13. printf '{"from": {"type": "indirect", "id": "%s-%s"}, "to": {"type": "git", "url": "https://gitlab.intr/%s/%s"}}\n' "$group" "$name" "$group" "$name"
  14. done | jq --slurp
  15. }
  16. printf '{"version": 2, "flakes":%s}\n' "$(flakes)" | jq --monochrome-output --compact-output