{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/spack-mirrors-yaml/latest.json",
  "title": "Spack mirror configuration file schema",
  "x-lintel": {
    "source": "https://raw.githubusercontent.com/spack/schemas/refs/heads/main/schemas/mirrors.json",
    "sourceSha256": "1c9129630257f32365c3e1c94ee61694d76729d912b021c1a435a481e0bc8467",
    "fileMatch": [
      "**/*spack/**/mirrors.yaml"
    ],
    "parsers": [
      "yaml"
    ]
  },
  "type": "object",
  "properties": {
    "mirrors": {
      "type": "object",
      "default": {},
      "description": "Configure local and remote mirrors that provide repositories of source tarballs and binary build caches for faster package installation",
      "additionalProperties": {
        "description": "Named mirror configuration that can be a simple URL string or detailed mirror entry with authentication and build cache settings",
        "anyOf": [
          {
            "type": "string",
            "description": "Simple mirror URL for basic source package or build cache access"
          },
          {
            "type": "object",
            "description": "Mirror configuration entry supporting both source package archives and binary build caches with optional authentication",
            "properties": {
              "source": {
                "type": "boolean",
                "description": "Whether this mirror provides source package archives (tarballs) for building from source"
              },
              "binary": {
                "type": "boolean",
                "description": "Whether this mirror provides binary build caches for installing precompiled packages"
              },
              "signed": {
                "type": "boolean",
                "description": "Whether to require GPG signature verification for packages from this mirror"
              },
              "fetch": {
                "description": "Configuration for fetching/downloading packages from this mirror",
                "anyOf": [
                  {
                    "type": "string",
                    "description": "Simple URL string for basic mirror connections without authentication"
                  },
                  {
                    "type": "object",
                    "description": "Detailed connection configuration with authentication and custom settings",
                    "properties": {
                      "url": {
                        "type": "string",
                        "description": "URL pointing to the mirror directory, can be local filesystem (file://) or remote server (http://, <https://>, s3://, oci://)"
                      },
                      "access_pair": {
                        "type": "object",
                        "description": "Authentication credentials for accessing private mirrors with ID and secret pairs",
                        "required": [
                          "secret_variable"
                        ],
                        "oneOf": [
                          {
                            "required": [
                              "id"
                            ]
                          },
                          {
                            "required": [
                              "id_variable"
                            ]
                          }
                        ],
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Static access ID or username for authentication"
                          },
                          "id_variable": {
                            "type": "string",
                            "description": "Environment variable name containing the access ID or username"
                          },
                          "secret_variable": {
                            "type": "string",
                            "description": "Environment variable name containing the secret key, password, or access token"
                          }
                        }
                      },
                      "profile": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "AWS profile name to use for S3 mirror authentication"
                      },
                      "endpoint_url": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "Custom endpoint URL for S3-compatible storage services"
                      },
                      "access_token_variable": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "Environment variable containing an access token for OCI registry authentication"
                      }
                    },
                    "additionalProperties": false
                  }
                ]
              },
              "push": {
                "description": "Configuration for pushing/uploading packages to this mirror for build cache creation",
                "anyOf": [
                  {
                    "type": "string",
                    "description": "Simple URL string for basic mirror connections without authentication"
                  },
                  {
                    "type": "object",
                    "description": "Detailed connection configuration with authentication and custom settings",
                    "properties": {
                      "url": {
                        "type": "string",
                        "description": "URL pointing to the mirror directory, can be local filesystem (file://) or remote server (http://, <https://>, s3://, oci://)"
                      },
                      "access_pair": {
                        "type": "object",
                        "description": "Authentication credentials for accessing private mirrors with ID and secret pairs",
                        "required": [
                          "secret_variable"
                        ],
                        "oneOf": [
                          {
                            "required": [
                              "id"
                            ]
                          },
                          {
                            "required": [
                              "id_variable"
                            ]
                          }
                        ],
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Static access ID or username for authentication"
                          },
                          "id_variable": {
                            "type": "string",
                            "description": "Environment variable name containing the access ID or username"
                          },
                          "secret_variable": {
                            "type": "string",
                            "description": "Environment variable name containing the secret key, password, or access token"
                          }
                        }
                      },
                      "profile": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "AWS profile name to use for S3 mirror authentication"
                      },
                      "endpoint_url": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "Custom endpoint URL for S3-compatible storage services"
                      },
                      "access_token_variable": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "Environment variable containing an access token for OCI registry authentication"
                      }
                    },
                    "additionalProperties": false
                  }
                ]
              },
              "autopush": {
                "type": "boolean",
                "description": "Automatically push packages to this build cache immediately after they are installed locally"
              },
              "url": {
                "type": "string",
                "description": "URL pointing to the mirror directory, can be local filesystem (file://) or remote server (http://, <https://>, s3://, oci://)"
              },
              "access_pair": {
                "type": "object",
                "description": "Authentication credentials for accessing private mirrors with ID and secret pairs",
                "required": [
                  "secret_variable"
                ],
                "oneOf": [
                  {
                    "required": [
                      "id"
                    ]
                  },
                  {
                    "required": [
                      "id_variable"
                    ]
                  }
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "description": "Static access ID or username for authentication"
                  },
                  "id_variable": {
                    "type": "string",
                    "description": "Environment variable name containing the access ID or username"
                  },
                  "secret_variable": {
                    "type": "string",
                    "description": "Environment variable name containing the secret key, password, or access token"
                  }
                }
              },
              "profile": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "AWS profile name to use for S3 mirror authentication"
              },
              "endpoint_url": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Custom endpoint URL for S3-compatible storage services"
              },
              "access_token_variable": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Environment variable containing an access token for OCI registry authentication"
              }
            },
            "anyOf": [
              {
                "required": [
                  "url"
                ]
              },
              {
                "required": [
                  "fetch"
                ]
              },
              {
                "required": [
                  "pull"
                ]
              }
            ],
            "additionalProperties": false
          }
        ]
      }
    }
  },
  "additionalProperties": false
}
