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

127 lines
2.8 KiB
Nix

{
stdenv,
akku,
chez,
guile,
chibi,
makeWrapper,
lib,
writeShellScriptBin,
}:
{
pname,
version,
src,
buildInputs ? [ ],
r7rs ? false,
nativeBuildInputs ? [ ],
...
}@args:
let
parse-akku_ = writeShellScriptBin "parse-akku" "${guile}/bin/guile --no-auto-compile ${./parse-akku.scm} \"$@\"";
parse-akku = "${parse-akku_}/bin/parse-akku";
in
stdenv.mkDerivation (
{
inherit version src;
pname = "akku-${pname}";
propagatedBuildInputs = buildInputs;
buildInputs = [ ];
nativeBuildInputs = [
makeWrapper
akku
chez
chibi
] ++ nativeBuildInputs;
buildPhase = ''
runHook preBuild
# only install the project
rm -f Akku.lock Akku.manifest
akku install
# make sure akku metadata is present during testing and onwards
echo $PWD $CHEZSCHEMELIBDIRS \
| sed "s/:/ /g" \
| xargs find \
| grep "metadata.sls" \
| xargs ${parse-akku} merge ${pname} ${version} > temp___
mv temp___ .akku/lib/akku/metadata.sls
runHook postBuild
'';
checkPhase = ''
IS_R7RS=false
runHook preCheck
propagated_chez=$CHEZSCHEMELIBDIRS
propagated_chibi=$CHIBI_MODULE_PATH
export CHEZSCHEMELIBDIRS="$PWD/.akku/lib:$CHEZSCHEMELIBDIRS"
export CHIBI_MODULE_PATH="$PWD/.akku/lib:$CHIBI_MODULE_PATH"
# Run all test .sps files if they exist
# and run tests for libs mirrored from snow-fort.
for path in $(find test* -type f | grep -e "\.sps") \
$(find . | grep "run-test" | grep "\.scm"); do
echo Running test: $path
[[ "\n$SKIP\n" =~ $(basename $path) ]] && continue
if [ -x $path ]; then
patchShebangs $path
./$path
elif ${lib.trivial.boolToString r7rs}; then
chibi-scheme $path
else
scheme-script $path
fi
done
runHook postCheck
export CHEZSCHEMELIBDIRS=$propagated_chez
export CHIBI_MODULE_PATH=$propagated_chibi
'';
doCheck = true;
installPhase = ''
runHook preInstall
mkdir -p $out/lib
cd .akku
rm -f bin/activate*
cp -rL lib $out/lib/scheme-libs
cp -rL bin $out/bin
[ -d ffi ] && cp -rL ffi $out/lib
[ -d libobj ] && cp -rL libobj $out/lib
CHEZSCHEMELIBDIRS="$out/lib/scheme-libs:$CHEZSCHEMELIBDIRS"
# add support for other schemes
for f in $out/bin/*
do
patchShebangs $f
wrapProgram $f \
--prefix CHEZSCHEMELIBDIRS : $CHEZSCHEMELIBDIRS
done
runHook postInstall
'';
meta = {
inherit (akku.meta) platforms;
} // args.meta or { };
setupHook = ./setup-hook.sh;
}
// builtins.removeAttrs args [
"name"
"buildInputs"
"meta"
"nativeBuildInputs"
]
)