Commit fafebf71 authored by Robert Schütz's avatar Robert Schütz
Browse files

lib.concatAttrValues: init

This is useful for adding all optional-dependencies to the
nativeCheckInputs of Python packages.
parent 8052e273
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -303,6 +303,7 @@ let
        elem
        elemAt
        isList
        concatAttrValues
        ;
      inherit (self.strings)
        concatStrings
+23 −1
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ let
    id
    warn
    ;
  inherit (lib.attrsets) mapAttrs attrNames;
  inherit (lib.attrsets) mapAttrs attrNames attrValues;
  inherit (lib) max;
in
rec {
@@ -1997,4 +1997,26 @@ rec {
  */
  mutuallyExclusive = a: b: length a == 0 || !(any (x: elem x a) b);

  /**
    Concatenate all attributes of an attribute set.
    This assumes that every attribute of the set is a list.

    # Inputs

    `set`

    : Attribute set with attributes that are lists

    # Examples
    :::{.example}
    ## `lib.concatAttrValues` usage example

    ```nix
    concatAttrValues { a = [ 1 2 ]; b = [ 3 ]; }
    => [ 1 2 3 ]
    ```

    :::
  */
  concatAttrValues = set: concatLists (attrValues set);
}