Unverified Commit 3928cfa2 authored by Martin Weinelt's avatar Martin Weinelt Committed by GitHub
Browse files

Merge pull request #195862 from NixOS/staging-next

parents 598f7de7 71e4896d
Loading
Loading
Loading
Loading
+30 −1
Original line number Diff line number Diff line
@@ -157,7 +157,36 @@ rec {
                                }
                      );

  closePropagation = list: (uniqList {inputList = (innerClosePropagation [] list);});
  closePropagationSlow = list: (uniqList {inputList = (innerClosePropagation [] list);});

  # This is an optimisation of lib.closePropagation which avoids the O(n^2) behavior
  # Using a list of derivations, it generates the full closure of the propagatedXXXBuildInputs
  # The ordering / sorting / comparison is done based on the `outPath`
  # attribute of each derivation.
  # On some benchmarks, it performs up to 15 times faster than lib.closePropagation.
  # See https://github.com/NixOS/nixpkgs/pull/194391 for details.
  closePropagationFast = list:
    builtins.map (x: x.val) (builtins.genericClosure {
      startSet = builtins.map (x: {
        key = x.outPath;
        val = x;
      }) (builtins.filter (x: x != null) list);
      operator = item:
        if !builtins.isAttrs item.val then
          [ ]
        else
          builtins.concatMap (x:
            if x != null then [{
              key = x.outPath;
              val = x;
            }] else
              [ ]) ((item.val.propagatedBuildInputs or [ ])
                ++ (item.val.propagatedNativeBuildInputs or [ ]));
    });

  closePropagation = if builtins ? genericClosure
    then closePropagationFast
    else closePropagationSlow;

  # calls a function (f attr value ) for each record item. returns a list
  mapAttrsFlatten = f: r: map (attr: f attr r.${attr}) (attrNames r);
+1 −1
Original line number Diff line number Diff line
@@ -378,7 +378,7 @@ rec {

    attr = let attrFilter = name: value: name != "_module" && value != null;
    in ind: x: libStr.concatStringsSep "\n" (lib.flatten (lib.mapAttrsToList
      (name: value: lib.optional (attrFilter name value) [
      (name: value: lib.optionals (attrFilter name value) [
      (key "\t${ind}" name)
      (expr "\t${ind}" value)
    ]) x));
+1 −1
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ containers.database =
  { config =
      { config, pkgs, ... }:
      { services.postgresql.enable = true;
      services.postgresql.package = pkgs.postgresql_10;
      services.postgresql.package = pkgs.postgresql_14;
      };
  };
```
+1 −1
Original line number Diff line number Diff line
@@ -166,7 +166,7 @@ Packages
        pkgs.emacs
      ];

    services.postgresql.package = pkgs.postgresql_10;
    services.postgresql.package = pkgs.postgresql_14;
    ```

    The latter option definition changes the default PostgreSQL package
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ containers.database =
  { config =
      { config, pkgs, ... }:
      { services.postgresql.enable = true;
      services.postgresql.package = pkgs.postgresql_10;
      services.postgresql.package = pkgs.postgresql_14;
      };
  };
</programlisting>
Loading