mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-19 16:40:32 +03:00
treewide: format all inactive Nix files
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-build https://github.com/infinisil/treewide-nixpkgs-reformat-script/archive/a08b3a4d199c6124ac5b36a889d9099b4383463f.tar.gz \
--argstr baseRev 0128fbb0a5
result/bin/apply-formatting $NIXPKGS_PATH
This commit is contained in:
parent
0128fbb0a5
commit
d9d87c5196
21586 changed files with 712147 additions and 434007 deletions
|
@ -1,4 +1,11 @@
|
|||
testModuleArgs@{ config, lib, hostPkgs, nodes, moduleType, ... }:
|
||||
testModuleArgs@{
|
||||
config,
|
||||
lib,
|
||||
hostPkgs,
|
||||
nodes,
|
||||
moduleType,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkOption types;
|
||||
inherit (types) either str functionTo;
|
||||
|
@ -37,48 +44,50 @@ in
|
|||
withoutTestScriptReferences.testScript = lib.mkForce "testscript omitted";
|
||||
|
||||
testScriptString =
|
||||
if lib.isFunction config.testScript
|
||||
then
|
||||
config.testScript
|
||||
{
|
||||
nodes =
|
||||
lib.mapAttrs
|
||||
(k: v:
|
||||
if v.virtualisation.useNixStoreImage
|
||||
then
|
||||
# prevent infinite recursion when testScript would
|
||||
# reference v's toplevel
|
||||
config.withoutTestScriptReferences.nodesCompat.${k}
|
||||
else
|
||||
# reuse memoized config
|
||||
v
|
||||
)
|
||||
config.nodesCompat;
|
||||
}
|
||||
else config.testScript;
|
||||
if lib.isFunction config.testScript then
|
||||
config.testScript {
|
||||
nodes = lib.mapAttrs (
|
||||
k: v:
|
||||
if v.virtualisation.useNixStoreImage then
|
||||
# prevent infinite recursion when testScript would
|
||||
# reference v's toplevel
|
||||
config.withoutTestScriptReferences.nodesCompat.${k}
|
||||
else
|
||||
# reuse memoized config
|
||||
v
|
||||
) config.nodesCompat;
|
||||
}
|
||||
else
|
||||
config.testScript;
|
||||
|
||||
defaults = { config, name, ... }: {
|
||||
# Make sure all derivations referenced by the test
|
||||
# script are available on the nodes. When the store is
|
||||
# accessed through 9p, this isn't important, since
|
||||
# everything in the store is available to the guest,
|
||||
# but when building a root image it is, as all paths
|
||||
# that should be available to the guest has to be
|
||||
# copied to the image.
|
||||
virtualisation.additionalPaths =
|
||||
lib.optional
|
||||
# A testScript may evaluate nodes, which has caused
|
||||
# infinite recursions. The demand cycle involves:
|
||||
# testScript -->
|
||||
# nodes -->
|
||||
# toplevel -->
|
||||
# additionalPaths -->
|
||||
# hasContext testScript' -->
|
||||
# testScript (ad infinitum)
|
||||
# If we don't need to build an image, we can break this
|
||||
# cycle by short-circuiting when useNixStoreImage is false.
|
||||
(config.virtualisation.useNixStoreImage && builtins.hasContext testModuleArgs.config.testScriptString && testModuleArgs.config.includeTestScriptReferences)
|
||||
(hostPkgs.writeStringReferencesToFile testModuleArgs.config.testScriptString);
|
||||
};
|
||||
defaults =
|
||||
{ config, name, ... }:
|
||||
{
|
||||
# Make sure all derivations referenced by the test
|
||||
# script are available on the nodes. When the store is
|
||||
# accessed through 9p, this isn't important, since
|
||||
# everything in the store is available to the guest,
|
||||
# but when building a root image it is, as all paths
|
||||
# that should be available to the guest has to be
|
||||
# copied to the image.
|
||||
virtualisation.additionalPaths =
|
||||
lib.optional
|
||||
# A testScript may evaluate nodes, which has caused
|
||||
# infinite recursions. The demand cycle involves:
|
||||
# testScript -->
|
||||
# nodes -->
|
||||
# toplevel -->
|
||||
# additionalPaths -->
|
||||
# hasContext testScript' -->
|
||||
# testScript (ad infinitum)
|
||||
# If we don't need to build an image, we can break this
|
||||
# cycle by short-circuiting when useNixStoreImage is false.
|
||||
(
|
||||
config.virtualisation.useNixStoreImage
|
||||
&& builtins.hasContext testModuleArgs.config.testScriptString
|
||||
&& testModuleArgs.config.includeTestScriptReferences
|
||||
)
|
||||
(hostPkgs.writeStringReferencesToFile testModuleArgs.config.testScriptString);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue