nix-helpers: c166187efb940c7db1cea85e98d3b8cd6e287859

     1: # Traverse nested attribute sets, gathering a list of all derivations we find
     2: { lib, nothing, withDeps }:
     3: 
     4: with builtins;
     5: with lib;
     6: with rec {
     7:   go = collect isDerivation;
     8: 
     9:   testData = rec {
    10:     input = {
    11:       a = 5;
    12:       b = null;
    13:       c = true;
    14:       d = { };
    15:       e = "hello";
    16:       f = {
    17:         x = nothing;
    18:         y = nothing;
    19:         g = [ ];
    20:       };
    21:       z = nothing;
    22:     };
    23: 
    24:     message = "gotLength should equal shouldLength";
    25:     output = go input;
    26:     gotLength = length output;
    27:     shouldLength = 3;
    28:   };
    29: 
    30:   # We should ignore everything except the derivations ('nothing')
    31:   test = testData.gotLength == testData.shouldLength || abort (toJSON testData);
    32: };
    33: assert test;
    34: go

Generated by git2html.