mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-29 00:53:57 +00:00
4f0dadbf38
After final improvements to the official formatter implementation, this commit now performs the first treewide reformat of Nix files using it. This is part of the implementation of RFC 166. Only "inactive" files are reformatted, meaning only files that aren't being touched by any PR with activity in the past 2 months. This is to avoid conflicts for PRs that might soon be merged. Later we can do a full treewide reformat to get the rest, which should not cause as many conflicts. A CI check has already been running for some time to ensure that new and already-formatted files are formatted, so the files being reformatted here should also stay formatted. This commit was automatically created and can be verified using nix-builda08b3a4d19
.tar.gz \ --argstr baseRevb32a094368
result/bin/apply-formatting $NIXPKGS_PATH
61 lines
1.6 KiB
Nix
61 lines
1.6 KiB
Nix
# Call nix-build on this file to run all tests in this directory
|
|
|
|
# This produces a link farm derivation with the original attrs
|
|
# merged on top of it.
|
|
# You can run parts of the "hierarchy" with for example:
|
|
# nix-build -A java-properties
|
|
# See `structured` below.
|
|
|
|
{
|
|
pkgs ? import ../../.. { },
|
|
}:
|
|
let
|
|
inherit (pkgs.lib)
|
|
mapAttrs
|
|
mapAttrsToList
|
|
isDerivation
|
|
mergeAttrs
|
|
foldl'
|
|
attrValues
|
|
recurseIntoAttrs
|
|
;
|
|
|
|
structured = {
|
|
formats = import ./formats.nix { inherit pkgs; };
|
|
java-properties = recurseIntoAttrs {
|
|
jdk8 = pkgs.callPackage ../formats/java-properties/test { jdk = pkgs.jdk8; };
|
|
jdk11 = pkgs.callPackage ../formats/java-properties/test { jdk = pkgs.jdk11_headless; };
|
|
jdk17 = pkgs.callPackage ../formats/java-properties/test { jdk = pkgs.jdk17_headless; };
|
|
};
|
|
|
|
libconfig = recurseIntoAttrs (import ../formats/libconfig/test { inherit pkgs; });
|
|
|
|
hocon = recurseIntoAttrs (import ../formats/hocon/test { inherit pkgs; });
|
|
};
|
|
|
|
flatten =
|
|
prefix: as:
|
|
foldl' mergeAttrs { } (
|
|
attrValues (
|
|
mapAttrs (
|
|
k: v:
|
|
if isDerivation v then
|
|
{ "${prefix}${k}" = v; }
|
|
else if v ? recurseForDerivations then
|
|
flatten "${prefix}${k}-" (removeAttrs v [ "recurseForDerivations" ])
|
|
else
|
|
builtins.trace v throw "expected derivation or recurseIntoAttrs"
|
|
) as
|
|
)
|
|
);
|
|
in
|
|
|
|
# It has to be a link farm for inclusion in the hydra unstable jobset.
|
|
pkgs.linkFarm "pkgs-lib-formats-tests" (
|
|
mapAttrsToList (k: v: {
|
|
name = k;
|
|
path = v;
|
|
}) (flatten "" structured)
|
|
)
|
|
// structured
|