Hydra: how to use github_pulls with a flake?

I’m trying to set up a hydra build server to test some nixos configurations that live in a private github repo. It’s working really well for testing the main branch, with this declarative jobset configuration:

  "main": {
    "enabled": 1,
    "hidden": false,
    "description": "My system configuration - main branch",
    "flake": "git+ssh://git@github.com/antifuchs/that-private-repo?ref=main",
    "checkinterval": 3600,
    "schedulingshares": 100,
    "enableemail": false,
    "emailoverride": "",
    "keepnr": 3,
    "type": 1

However, I’m having trouble adapting this to the github_pulls input. Is there any way to refer to the ref of the PR head in the "flake" attribute? Or do I have to use the nixexprinput path and write non-flake->flake adapter boilerplate?

1 Like

Aaaand just when I ask this, I finally understand how everything fits together, thanks to another person’s brave trailblazing. I found nix-configuration/.hydra at ae7e5c439c97d87bc52d6f7acef629abcf3370f6 · Shawn8901/nix-configuration · GitHub, which has a perfect - working - example of what I want to accomplish:

  • The spec.json defines the meta-jobset that tells hydra how to compute the jobsets that should apply to the repo, by referring to the jobsets.nix file
  • The jobsets.nix file defines one jobset for the main branch and every PR that gets picked out from the meta-jobset’s inputs.
  • The only thing that needed adjusting a little bit was the flake references, which I adjusted to read "git+ssh://git@github.com/antifuchs/home?ref=${branch}" for the mkFlakeJobset function and "git+ssh://git@github.com/antifuchs/home?branch=pull/${num}/head" for the prJobsets function.

That’s all, now I have hydra builds for my personal repo, and it works remarkably well!

1 Like