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 a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
This commit is contained in:
Silvan Mosberger 2024-12-10 20:26:33 +01:00
parent b32a094368
commit 4f0dadbf38
21293 changed files with 701351 additions and 428307 deletions

View file

@ -4,8 +4,9 @@ with lib;
let
makeScript = name: service: pkgs.writeScript "${name}-runner"
''
makeScript =
name: service:
pkgs.writeScript "${name}-runner" ''
#! ${pkgs.perl.withPackages (p: [ p.FileSlurp ])}/bin/perl -w
use File::Slurp;
@ -46,13 +47,15 @@ let
next if $key eq 'LOCALE_ARCHIVE';
delete $ENV{$key};
}
${concatStrings (mapAttrsToList (n: v: ''
$ENV{'${n}'} = '${v}';
'') service.environment)}
${concatStrings (
mapAttrsToList (n: v: ''
$ENV{'${n}'} = '${v}';
'') service.environment
)}
# Run the ExecStartPre program. FIXME: this could be a list.
my $preStart = <<END_CMD;
${concatStringsSep "\n" (service.serviceConfig.ExecStartPre or [])}
${concatStringsSep "\n" (service.serviceConfig.ExecStartPre or [ ])}
END_CMD
if (defined $preStart && $preStart ne "\n") {
print STDERR "running ExecStartPre: $preStart\n";
@ -79,7 +82,7 @@ let
# Run the ExecStartPost program.
my $postStart = <<END_CMD;
${concatStringsSep "\n" (service.serviceConfig.ExecStartPost or [])}
${concatStringsSep "\n" (service.serviceConfig.ExecStartPost or [ ])}
END_CMD
if (defined $postStart && $postStart ne "\n") {
print STDERR "running ExecStartPost: $postStart\n";
@ -104,17 +107,19 @@ let
exit($mainRes & 127 ? 255 : $mainRes << 8);
'';
opts = { config, name, ... }: {
options.runner = mkOption {
internal = true;
description = ''
A script that runs the service outside of systemd,
useful for testing or for using NixOS services outside
of NixOS.
'';
opts =
{ config, name, ... }:
{
options.runner = mkOption {
internal = true;
description = ''
A script that runs the service outside of systemd,
useful for testing or for using NixOS services outside
of NixOS.
'';
};
config.runner = makeScript name config;
};
config.runner = makeScript name config;
};
in