Silvan Mosberger 4f0dadbf38 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 b32a0943687d2a5094a6d92f25a4b6e16a76b5b7
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

70 lines
1.5 KiB
Nix

{
stdenv,
lib,
ShellCheck,
haskell,
pandoc,
}:
# this wraps around the haskell package
# and puts the documentation into place
let
# TODO: move to lib/ in separate PR
overrideMeta =
drv: overrideFn:
let
drv' = if drv ? meta then drv else drv // { meta = { }; };
pos = (builtins.unsafeGetAttrPos "pname" drv');
meta' = drv'.meta // {
# copied from the mkDerivation code
position = pos.file + ":" + toString pos.line;
};
in
drv' // { meta = meta' // overrideFn meta'; };
bin = haskell.lib.compose.justStaticExecutables ShellCheck;
shellcheck = stdenv.mkDerivation {
pname = "shellcheck";
version = bin.version;
inherit (ShellCheck) meta src;
nativeBuildInputs = [ pandoc ];
outputs = [
"bin"
"man"
"doc"
"out"
];
buildPhase = ''
pandoc -s -f markdown-smart -t man shellcheck.1.md -o shellcheck.1
'';
installPhase = ''
install -Dm755 ${bin}/bin/shellcheck $bin/bin/shellcheck
install -Dm644 README.md $doc/share/shellcheck/README.md
install -Dm644 shellcheck.1 $man/share/man/man1/shellcheck.1
mkdir $out
'';
passthru = ShellCheck.passthru or { } // {
# pandoc takes long to build and documentation isn't needed for in nixpkgs usage
unwrapped = ShellCheck;
};
};
in
overrideMeta shellcheck (old: {
maintainers = with lib.maintainers; [ zowoq ];
mainProgram = "shellcheck";
outputsToInstall = [
"bin"
"man"
"doc"
];
})