Skip to content

Feature/source mirrors#283

Open
grodzki-lanl wants to merge 4 commits intoeth-cscs:mainfrom
grodzki-lanl:feature/source-mirrors
Open

Feature/source mirrors#283
grodzki-lanl wants to merge 4 commits intoeth-cscs:mainfrom
grodzki-lanl:feature/source-mirrors

Conversation

@grodzki-lanl
Copy link

Allows users to build from custom spack mirrors. Spack mirrors can be defined in recipes/config.yaml like so:

source_mirrors:
  <mirror1-name>: <url>
  <mirror2-name>: <url>

This will generate a site-scoped spack mirrors.yaml (via spack mirror add command in the Makefile) located in $(BUILD_ROOT)/spack/etc/spack

mirrors:
  mirror1-name: <url>
  mirror2-name: <url>
  spack-public:
    binary: false
    url: https://mirror.spack.io

The mirrors have precedence from top to bottom: spack will try to fetch from the first mirror, and will move down the list if the package is not found, defaulting to spack-public if none of the user-defined mirrors provide it.

@Paul-Ferrell
Copy link

Paul-Ferrell commented Mar 5, 2026

We're also going to need the ability to add mirrors for bootstrapping. ghcr.io isn't accessible from our clusters. We have to setup internal mirrors for that too.

We currently do the following:
Add the following bootstrap.yaml file in Spack's etc/spack directory.

bootstrap:
  sources:
  - name: 'pe-serve'
    metadata: $spack/etc/spack
  trusted:
    pe-serve: true

and add this metadata.yaml in the same place.

type: install
description: 
info:
  url: https://pe-serve.lanl.gov/spack-mirror

Spack stores source mirror information in directories with a metadata.yaml file to describe it. Our solution works because we drop the metadata.yaml file in etc/spack, and then declare that etc/spack is also a sources dir so it will look for the metadata file there. It's super hacky. It would make more sense to actually set up a real source definition directory somewhere, but I was able to get our solution to work without any code changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants