about summary refs log blame commit diff
path: root/corepkgs/derivation.nix
blob: d5044a83b1c27042cb69dc58d67ae4fb494184fc (plain) (tree)
1
2
3
4
5
6
7
8
9








                                                                       

                                       
                        
                                                     

                                 
                                   














                                                                        
attrs:

let

  strict = derivationStrict attrs;
  
  attrValues = attrs:
    map (name: builtins.getAttr name attrs) (builtins.attrNames attrs);
    
  outputToAttrListElement = outputName:
    { name = outputName;
      value = attrs // {
        outPath = builtins.getAttr outputName strict;
        drvPath = strict.drvPath;
        type = "derivation";
        currentOutput = outputName;
      } // outputsAttrs // { all = allList; };
    };
    
  outputsList =
    if attrs ? outputs
    then map outputToAttrListElement attrs.outputs
    else [ (outputToAttrListElement "out") ];
    
  outputsAttrs = builtins.listToAttrs outputsList;
  
  allList = attrValues outputsAttrs;
  
  head = if attrs ? outputs then builtins.head attrs.outputs else "out";
  
in builtins.getAttr head outputsAttrs