query
On this page

hydraJob

lib.hydraJob

Docs pulled from | This Revision | about 1 hour ago


Strip a derivation of all non-essential attributes, returning only those needed by hydra-eval-jobs. Also strictly evaluate the result to ensure that there are no thunks kept alive to prevent garbage collection.

Inputs

drv

1. Function argument

Type

hydraJob :: (Derivation | Null) -> (Derivation | Null)
(lib.customisation.hydraJob)

Noogle detected

Aliases

Implementation

The following is the current implementation of this function.

hydraJob =
    drv:
    let
      outputs = drv.outputs or [ "out" ];

      commonAttrs =
        {
          inherit (drv) name system meta;
          inherit outputs;
        }
        // optionalAttrs (drv._hydraAggregate or false) {
          _hydraAggregate = true;
          constituents = map hydraJob (flatten drv.constituents);
        }
        // (listToAttrs outputsList);

      makeOutput =
        outputName:
        let
          output = drv.${outputName};
        in
        {
          name = outputName;
          value = commonAttrs // {
            outPath = output.outPath;
            drvPath = output.drvPath;
            type = "derivation";
            inherit outputName;
          };
        };

      outputsList = map makeOutput outputs;

      drv' = (head outputsList).value;
    in
    if drv == null then null else deepSeq drv' drv';