Custom board in custom package

Hello,
I would like to distribute custom boards json, and to do that I put them in a git repo.
To use them, I do something like this:
platform_packages = custom_boards @ file:///
and in platformio section:
boards_dir=${platformio.packages_dir}/custom_boards

inside I have package.json with name “custom_boards”.

If I install it manually using pio pkg install --tool file:///, then “pio run” works.

However, if the package is not installed, I get an error Unknown board ID (and does not install first the platform_packages)

But I know that boards that are in builders are working: the builder is downloaded first and it then can find the board.
I think I’m doing it wrong, but cannot figure it out .
(of course, the file:// is only for testing, it will be a git repo at the end)

Thank you a lot!