hercules-ci / support

User feedback, questions and our public roadmap. help@hercules-ci.com
5 stars 1 forks source link

Recursively build attrs #42

Closed mkg20001 closed 4 years ago

mkg20001 commented 4 years ago

I have a ci.nix that looks roughly like this:

{
  someAttr = {
    drv = ...;
    otherDrv = ...;
  };
}

The derivations aren't getting built if they're nested deeper than one key. Is there any way to solve that?

roberth commented 4 years ago

Yes, for example

let
  # import from nixpkgs/lib or
  recurseIntoAttrs = as: as // { recurseForDerivations = true; };
in
{
  someAttr = recurseIntoAttrs {
    drv = ...;
    otherDrv = ...;
  };
}

See also https://docs.hercules-ci.com/hercules-ci/reference/evaluation/

or if you're creating a build matrix, dimension may be nice and also sets this.

The reason this special attribute is required, is for compatibility with nix-build.

mkg20001 commented 4 years ago

Ok, thx