diff --git a/nix-channels.py b/nix-channels.py index fe3dddf..bec8ec9 100644 --- a/nix-channels.py +++ b/nix-channels.py @@ -261,6 +261,8 @@ def clone_channels(): def update_channels(channels): logging.info(f'- Updating binary cache') + has_cache_info = False + for channel in channels: logging.info(f' - {channel}') @@ -268,6 +270,18 @@ def update_channels(channels): upstream_binary_cache = (chan_path_update / '.original-binary-cache-url').read_text() + # All the channels should have https://cache.nixos.org as binary cache + # URL. We download nix-cache-info here (once per sync) to avoid + # hard-coding it, and in case it changes. + if not has_cache_info: + info_file = 'nix-cache-info' + logging.info(f' - Downloading {info_file}') + download( + f'{upstream_binary_cache}/{info_file}', + working_dir / STORE_DIR / info_file + ) + has_cache_info = True + with lzma.open(str(chan_path_update / 'store-paths.xz')) as f: paths = [ path.rstrip() for path in f ]